

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: Hash Functions
incomplete
2: Hash Collisions
incomplete
3: Hashmaps
incomplete
4: Deterministic
incomplete
5: One Way
incomplete
6: Toy Hash Function
incomplete
7: Toy Hash Review
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Review the toy hash() function from the last assignment:
func hash(input []byte) [4]byte {
for i, b := range input {
rotated := bits.RotateLeft8(uint8(b), 3)
input[i] = byte(rotated)
}
for i, b := range input {
shifted := b << 2
input[i] = byte(shifted)
}
final := [4]byte{}
for i, b := range input {
final[i%len(final)] ^= b
}
return final
}