github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/crypto/keys/mintkey/mintkey_bench_test.go (about) 1 package mintkey 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 "github.com/tendermint/crypto/bcrypt" 9 10 "github.com/fibonacci-chain/fbc/libs/tendermint/crypto" 11 ) 12 13 func BenchmarkBcryptGenerateFromPassword(b *testing.B) { 14 passphrase := []byte("passphrase") 15 for securityParam := 9; securityParam < 16; securityParam++ { 16 param := securityParam 17 b.Run(fmt.Sprintf("benchmark-security-param-%d", param), func(b *testing.B) { 18 saltBytes := crypto.CRandBytes(16) 19 b.ResetTimer() 20 for i := 0; i < b.N; i++ { 21 _, err := bcrypt.GenerateFromPassword(saltBytes, passphrase, param) 22 require.Nil(b, err) 23 } 24 }) 25 } 26 }