RS Hash

RS is a hash function algorithm.



									Public Shared Function RSHash(str As String) As UInteger
	Dim b As UInteger = 378551
	Dim a As ULong = 63689
	Dim hash As ULong = 0
	Dim i As UInteger = 0

	For i = 0 To str.Length - 1
		hash = (hash * a + CByte(AscW(str(CInt(i))))) And UInteger.MaxValue
		a = (a * b) And UInteger.MaxValue
	Next

	Return hash
End Function
								


Example

									Dim data = "jdfgsdhfsdfsd 6445dsfsd7fg/*/+bfjsdgf%$^"
Dim value = RSHash(data)
								


Output

									2012450421