instead of padding with 0's, cycle through the secret.

This commit is contained in:
Anthony Woods 2016-01-26 04:18:44 +08:00
parent 40d946a6e3
commit 092bb69c41

View File

@ -60,11 +60,7 @@ func encryptionKeyToBytes(secret string) []byte {
keyBytes := []byte(secret)
secretLength := len(keyBytes)
for i := 0; i < 32; i++ {
if secretLength > i {
key[i] = keyBytes[i]
} else {
key[i] = 0
}
key[i] = keyBytes[i%secretLength]
}
return key
}