mirror of
https://github.com/muun/recovery.git
synced 2025-11-12 06:50:18 -05:00
Update project structure and build process
This commit is contained in:
27
libwallet/scrypt.go
Executable file
27
libwallet/scrypt.go
Executable file
@@ -0,0 +1,27 @@
|
||||
package libwallet
|
||||
|
||||
import (
|
||||
"golang.org/x/crypto/scrypt"
|
||||
)
|
||||
|
||||
const (
|
||||
iterations = 512
|
||||
blockSize = 8
|
||||
parallelizationFactor = 1
|
||||
outputLength = 32
|
||||
)
|
||||
|
||||
func Scrypt256(data, salt []byte) []byte {
|
||||
return scrypt256(data, salt, iterations, blockSize, parallelizationFactor)
|
||||
}
|
||||
|
||||
func scrypt256(data, salt []byte, iterations, blockSize, parallelizationFactor int) []byte {
|
||||
|
||||
key, err := scrypt.Key(data, salt, iterations, blockSize, parallelizationFactor, outputLength)
|
||||
|
||||
if err != nil {
|
||||
panic("scrypt parameters are bad")
|
||||
}
|
||||
|
||||
return key
|
||||
}
|
||||
Reference in New Issue
Block a user