forked from TrueCloudLab/frostfs-api-go
initial
This commit is contained in:
commit
1cf33e5ffd
87 changed files with 29835 additions and 0 deletions
17
hash/salt.go
Normal file
17
hash/salt.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package hash
|
||||
|
||||
// SaltXOR xors bits of data with salt
|
||||
// repeating salt if necessary.
|
||||
func SaltXOR(data, salt []byte) (result []byte) {
|
||||
result = make([]byte, len(data))
|
||||
ls := len(salt)
|
||||
if ls == 0 {
|
||||
copy(result, data)
|
||||
return
|
||||
}
|
||||
|
||||
for i := range result {
|
||||
result[i] = data[i] ^ salt[i%ls]
|
||||
}
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue