Commits

Cliff Dyer committed b8ce212

Added salsa20 hash function.

  • Participants
  • Parent commits 2e98f06

Comments (0)

Files changed (1)

+package hash
+
+
+import (
+    "bitbucket.org/cliff/salsa20/endian"
+    "bitbucket.org/cliff/salsa20/round"
+)
+
+func Salsa20Hash(bytes []byte) []byte {
+    //outbytes := make([]byte, 64)
+    duplicate_words := make([]uint32, 16, 16)
+    words := endian.ToLittle(bytes)
+    for i:=0; i<len(words); i++ {
+        duplicate_words[i] = words[i]
+    }
+    for i:=0; i < 10; i++ {
+        round.Doubleround(words)
+    }
+    for i:=0; i<len(words); i++ {
+        words[i] += duplicate_words[i]
+    }
+    bytes = endian.FromLittle(words)
+    
+    return bytes
+}