27 lines
628 B
Go
27 lines
628 B
Go
package mintkey
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/tendermint/crypto/bcrypt"
|
|
|
|
"github.com/tendermint/tendermint/crypto"
|
|
)
|
|
|
|
func BenchmarkBcryptGenerateFromPassword(b *testing.B) {
|
|
passphrase := []byte("passphrase")
|
|
for securityParam := 9; securityParam < 16; securityParam++ {
|
|
param := securityParam
|
|
b.Run(fmt.Sprintf("benchmark-security-param-%d", param), func(b *testing.B) {
|
|
saltBytes := crypto.CRandBytes(16)
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
_, err := bcrypt.GenerateFromPassword(saltBytes, passphrase, param)
|
|
require.Nil(b, err)
|
|
}
|
|
})
|
|
}
|
|
}
|