Hello everyone! I've created a hashing algorithm. I'm not sure how good it is, but it's certainly slow and therefore might be difficult to crack. Efficiency improvements are more than welcome (given that it can take a matter of seconds to hash one of its own 1024-bit hashes in hexadecimal form - not good for mainstream use) of course! And if someone could find a collision, that would be great too.
Finally, don't ask about the name.
Some example results follow.Code:Public Class AllAngelsManaged Public Function ComputeHash(ByVal data() As Byte, Optional ByVal level As UInt64 = 0) As Byte() If data.Length = 0 Then Return Nothing Dim a() As UInt64 = { &HCA1A000070UL, &HAEE5A00070UL, &H7AA0000070UL, &H755AA40070UL, &H1CEC171A70UL, &H6C0E71A070UL, &HAD011CA070UL, &H7AE71CA070UL, &H7AC4AD0070UL, &HA1E0000070UL, &H671A500070UL, &HEE0E77A070UL, &H75AA000070UL, &H55A0500070UL, &H1057A00070UL, &HB7AD100070UL, &HFFFFFFFFFFUL } '16 "angels" and "all the rest" make 17 values Dim m As UInt64 = data(0) + 1 Dim f1, f2 As UInt64 For i As Integer = 0 To data.Length - 1 If i Mod 2 = 0 Then 'One foot f1 = (f1 + data(i)) Mod UInt32.MaxValue For j As Integer = i To f1 a(i Mod a.Length) = (a(i Mod a.Length) + f1 Mod (j + m)) Mod UInt32.MaxValue a((i + j) Mod a.Length) = (a((i + f2) Mod a.Length) + a((i + j + 5) Mod a.Length)) Mod UInt32.MaxValue Next m = LRot(m, data(i)) + m Mod 10099 Else 'The other f2 = (f2 + data(i)) Mod UInt32.MaxValue For j As Integer = i To f2 a(i Mod a.Length) = (a(i Mod a.Length) + f2 Mod (j + m)) Mod UInt32.MaxValue a((i + j) Mod a.Length) = (a((i + f1) Mod a.Length) + a((i + j + 5) Mod a.Length)) Mod UInt32.MaxValue Next End If Next 'Maximum level can be adjusted. '0 maximum: AllAngels/0-32 512-bit hash '1 maximum: AllAngels/1-64 1024-bit "speedy" hash '2 maximum: AllAngels/2-64 1024-bit "triple/half-round" hash '3 maximum: AllAngels/3-64++ 1024-bit hash '4 maximum: AllAngels/4-64++ "slow/full-round" hash If level < 1 Then For i As Integer = 0 To a.Length - 2 For Each n As Byte In Me.ComputeHash(BitConverter.GetBytes(a(i)), level + 1) a(n Mod (a.Length - 1)) = LRot(a(n Mod (a.Length - 1)), n) Xor Not n Next Next End If Dim r As New List(Of Byte) 'Normally, all angels would be used (and that fits 'perfectly in the text box) but to make this a '512- or 1024-bit hash we remove "the rest". For i As Integer = 0 To a.Length - 2 r.AddRange(BitConverter.GetBytes(a(i))) Next Return r.ToArray() End Function Protected Function LRot(ByVal num As UInt64, ByVal places As Integer) As UInt64 places = places Mod 64 Return num << places Or num >> (64 - places) End Function End Class
givesThis is a *really secure hash* or RSA. It's also a *slow hashing algorithm* or SHA. Am I abusing acronyms? Yes, yes I am.
Code:1f009000daafe345e8aced71e4423db50404e818785000c320d57835fa9c5617ca9924d7b56c11dc34a1b2a7a832da8832e1d908c9f7b3da34a8515e422a2335f098bbfe05d0777723a94b7f7705b57583366068f35d658af607b4faa3da77226a4adb1207de05417af4d1ca0c89b6cb1846e4cee9543af6cb7869c158660365givesThis is a *really secure hash* or RSA. It's also a *slow hashing algorithm* or SHA. Am I abusing acronyms? Yes, yes I an.
Code:974a1f35ff00b0002b4a4c0c86ba3017ae2b1a698c4bb0fadc22bce5a4e467e66f94c68b269a57b8717a8794bcaf20053b4b2306a5d2042d81e775217930ef09170047e0f0a7c55951f96ae788a16eefdf22addef24e8a99f62cb613885c07d84c48b9053a95465c960e1ba5a76f1deb742ed00060be17e2d4ff7110e742a099


Reply With Quote