chore: gofumpt (#11839)
* fumpt using main not master... * be more descriptive * fumpt * fix nits Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
Julien Robert
parent
bc2d553f77
commit
55054282d2
@@ -148,7 +148,6 @@ func EncryptArmorPrivKey(privKey cryptotypes.PrivKey, passphrase string, algo st
|
||||
func encryptPrivKey(privKey cryptotypes.PrivKey, passphrase string) (saltBytes []byte, encBytes []byte) {
|
||||
saltBytes = crypto.CRandBytes(16)
|
||||
key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter)
|
||||
|
||||
if err != nil {
|
||||
panic(sdkerrors.Wrap(err, "error generating bcrypt key from passphrase"))
|
||||
}
|
||||
|
||||
+8
-9
@@ -22,21 +22,20 @@ const (
|
||||
Sr25519Type = PubKeyType("sr25519")
|
||||
)
|
||||
|
||||
var (
|
||||
// Secp256k1 uses the Bitcoin secp256k1 ECDSA parameters.
|
||||
Secp256k1 = secp256k1Algo{}
|
||||
)
|
||||
// Secp256k1 uses the Bitcoin secp256k1 ECDSA parameters.
|
||||
var Secp256k1 = secp256k1Algo{}
|
||||
|
||||
type DeriveFn func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
type GenerateFn func(bz []byte) types.PrivKey
|
||||
type (
|
||||
DeriveFn func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
GenerateFn func(bz []byte) types.PrivKey
|
||||
)
|
||||
|
||||
type WalletGenerator interface {
|
||||
Derive(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
Generate(bz []byte) types.PrivKey
|
||||
}
|
||||
|
||||
type secp256k1Algo struct {
|
||||
}
|
||||
type secp256k1Algo struct{}
|
||||
|
||||
func (s secp256k1Algo) Name() PubKeyType {
|
||||
return Secp256k1Type
|
||||
@@ -63,7 +62,7 @@ func (s secp256k1Algo) Derive() DeriveFn {
|
||||
// Generate generates a secp256k1 private key from the given bytes.
|
||||
func (s secp256k1Algo) Generate() GenerateFn {
|
||||
return func(bz []byte) types.PrivKey {
|
||||
var bzArr = make([]byte, secp256k1.PrivKeySize)
|
||||
bzArr := make([]byte, secp256k1.PrivKeySize)
|
||||
copy(bzArr, bz)
|
||||
|
||||
return &secp256k1.PrivKey{Key: bzArr}
|
||||
|
||||
@@ -89,7 +89,6 @@ func TestParamsFromPath(t *testing.T) {
|
||||
require.Nil(t, params, errStr)
|
||||
require.Error(t, err, errStr)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCreateHDPath(t *testing.T) {
|
||||
|
||||
@@ -19,7 +19,6 @@ func TestInMemoryCreateLedger(t *testing.T) {
|
||||
kb := NewInMemory(cdc)
|
||||
|
||||
k, err := kb.SaveLedgerKey("some_account", hd.Secp256k1, "cosmos", 118, 3, 1)
|
||||
|
||||
if err != nil {
|
||||
require.Error(t, err)
|
||||
require.Equal(t, "ledger nano S: support for ledger devices is not available in this executable", err.Error())
|
||||
|
||||
@@ -255,7 +255,6 @@ func unMarshalLegacyInfo(bz []byte) (info LegacyInfo, err error) {
|
||||
|
||||
// privKeyFromLegacyInfo exports a private key from LegacyInfo
|
||||
func privKeyFromLegacyInfo(info LegacyInfo) (cryptotypes.PrivKey, error) {
|
||||
|
||||
switch linfo := info.(type) {
|
||||
case legacyLocalInfo:
|
||||
if linfo.PrivKeyArmor == "" {
|
||||
|
||||
@@ -229,6 +229,7 @@ func (s *MigrationTestSuite) TestMigrateErrEmptyItemData() {
|
||||
_, err := s.ks.migrate(n1)
|
||||
s.Require().EqualError(err, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, n1).Error())
|
||||
}
|
||||
|
||||
func TestMigrationTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(MigrationTestSuite))
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ func TestAltSigningAlgoList_String(t *testing.T) {
|
||||
require.Equal(t, fmt.Sprintf("%s,notSupported", hd.Secp256k1Type), list.String())
|
||||
}
|
||||
|
||||
type notSupportedAlgo struct {
|
||||
}
|
||||
type notSupportedAlgo struct{}
|
||||
|
||||
func (n notSupportedAlgo) Name() hd.PubKeyType {
|
||||
return "notSupported"
|
||||
|
||||
@@ -34,8 +34,10 @@ const (
|
||||
keyType = "ed25519"
|
||||
)
|
||||
|
||||
var _ cryptotypes.PrivKey = &PrivKey{}
|
||||
var _ codec.AminoMarshaler = &PrivKey{}
|
||||
var (
|
||||
_ cryptotypes.PrivKey = &PrivKey{}
|
||||
_ codec.AminoMarshaler = &PrivKey{}
|
||||
)
|
||||
|
||||
// Bytes returns the privkey byte format.
|
||||
func (privKey *PrivKey) Bytes() []byte {
|
||||
@@ -150,8 +152,10 @@ func GenPrivKeyFromSecret(secret []byte) *PrivKey {
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
var _ cryptotypes.PubKey = &PubKey{}
|
||||
var _ codec.AminoMarshaler = &PubKey{}
|
||||
var (
|
||||
_ cryptotypes.PubKey = &PubKey{}
|
||||
_ codec.AminoMarshaler = &PubKey{}
|
||||
)
|
||||
|
||||
// Address is the SHA256-20 of the raw pubkey bytes.
|
||||
// It doesn't implement ADR-28 addresses and it must not be used
|
||||
|
||||
@@ -30,7 +30,6 @@ func BenchmarkSigning(b *testing.B, priv types.PrivKey) {
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := priv.Sign(message)
|
||||
|
||||
if err != nil {
|
||||
b.FailNow()
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ func IsSNormalized(sigS *big.Int) bool {
|
||||
// NormalizeS will invert the s value if not already in the lower half
|
||||
// of curve order value
|
||||
func NormalizeS(sigS *big.Int) *big.Int {
|
||||
|
||||
if IsSNormalized(sigS) {
|
||||
return sigS
|
||||
}
|
||||
@@ -41,7 +40,6 @@ func NormalizeS(sigS *big.Int) *big.Int {
|
||||
// R, S are padded to 32 bytes respectively.
|
||||
// code roughly copied from secp256k1_nocgo.go
|
||||
func signatureRaw(r *big.Int, s *big.Int) []byte {
|
||||
|
||||
rBytes := r.Bytes()
|
||||
sBytes := s.Bytes()
|
||||
sigBytes := make([]byte, 64)
|
||||
@@ -90,10 +88,8 @@ func (sk *PrivKey) Bytes() []byte {
|
||||
// It then raw encodes the signature as two fixed width 32-byte values
|
||||
// concatenated, reusing the code copied from secp256k1_nocgo.go
|
||||
func (sk *PrivKey) Sign(msg []byte) ([]byte, error) {
|
||||
|
||||
digest := sha256.Sum256(msg)
|
||||
r, s, err := ecdsa.Sign(rand.Reader, &sk.PrivateKey, digest[:])
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ func (suite *SKSuite) TestMarshal() {
|
||||
require := suite.Require()
|
||||
const size = 32
|
||||
|
||||
var buffer = make([]byte, size)
|
||||
buffer := make([]byte, size)
|
||||
_, err := suite.sk.MarshalTo(buffer)
|
||||
require.NoError(err)
|
||||
|
||||
var sk = new(PrivKey)
|
||||
sk := new(PrivKey)
|
||||
err = sk.Unmarshal(buffer, secp256r1, size)
|
||||
require.NoError(err)
|
||||
require.True(sk.Equal(&suite.sk.PrivateKey))
|
||||
|
||||
@@ -60,7 +60,6 @@ func (pk *PubKey) Bytes() []byte {
|
||||
// lower half of the curve order
|
||||
// 7/21/21 - expects raw encoded signature (fixed-width 64-bytes, R || S)
|
||||
func (pk *PubKey) VerifySignature(msg []byte, sig []byte) bool {
|
||||
|
||||
// check length for raw signature
|
||||
// which is two 32-byte padded big.Ints
|
||||
// concatenated
|
||||
|
||||
@@ -59,12 +59,12 @@ func (suite *PKSuite) TestMarshal() {
|
||||
require := suite.Require()
|
||||
const size = 33 // secp256r1 size
|
||||
|
||||
var buffer = make([]byte, size)
|
||||
buffer := make([]byte, size)
|
||||
n, err := suite.pk.MarshalTo(buffer)
|
||||
require.NoError(err)
|
||||
require.Equal(size, n)
|
||||
|
||||
var pk = new(PubKey)
|
||||
pk := new(PubKey)
|
||||
err = pk.Unmarshal(buffer, secp256r1, size)
|
||||
require.NoError(err)
|
||||
require.True(pk.PublicKey.Equal(&suite.pk.PublicKey))
|
||||
|
||||
@@ -11,8 +11,10 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
||||
)
|
||||
|
||||
var _ multisigtypes.PubKey = &LegacyAminoPubKey{}
|
||||
var _ types.UnpackInterfacesMessage = &LegacyAminoPubKey{}
|
||||
var (
|
||||
_ multisigtypes.PubKey = &LegacyAminoPubKey{}
|
||||
_ types.UnpackInterfacesMessage = &LegacyAminoPubKey{}
|
||||
)
|
||||
|
||||
// NewLegacyAminoPubKey returns a new LegacyAminoPubKey.
|
||||
// Multisig can be constructed with multiple same keys - it will increase the power of
|
||||
|
||||
@@ -110,7 +110,8 @@ func TestVerifyMultisignature(t *testing.T) {
|
||||
pk = genPk
|
||||
},
|
||||
true,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"wrong size for sig bit array",
|
||||
func(require *require.Assertions) {
|
||||
pubKeys := generatePubKeys(3)
|
||||
@@ -165,7 +166,8 @@ func TestVerifyMultisignature(t *testing.T) {
|
||||
)
|
||||
},
|
||||
true,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"duplicate signatures",
|
||||
func(require *require.Assertions) {
|
||||
pubKeys, sigs := generatePubKeysAndSignatures(5, msg)
|
||||
@@ -178,7 +180,8 @@ func TestVerifyMultisignature(t *testing.T) {
|
||||
sig.Signatures = append(sig.Signatures, sigs[0])
|
||||
},
|
||||
false,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"duplicated key",
|
||||
func(require *require.Assertions) {
|
||||
// here we test an edge case where we create a multi sig with two same
|
||||
@@ -191,7 +194,8 @@ func TestVerifyMultisignature(t *testing.T) {
|
||||
multisig.AddSignature(sig, sigs[0], 1)
|
||||
},
|
||||
true,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"same key used twice",
|
||||
func(require *require.Assertions) {
|
||||
pubkeys, sigs := generatePubKeysAndSignatures(3, msg)
|
||||
@@ -201,7 +205,8 @@ func TestVerifyMultisignature(t *testing.T) {
|
||||
multisig.AddSignature(sig, sigs[0], 1)
|
||||
},
|
||||
false,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"unable to verify signature",
|
||||
func(require *require.Assertions) {
|
||||
pubKeys := generatePubKeys(2)
|
||||
|
||||
@@ -93,19 +93,19 @@ func (BitCurve *BitCurve) Params() *elliptic.CurveParams {
|
||||
// IsOnCurve returns true if the given (x,y) lies on the BitCurve.
|
||||
func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool {
|
||||
// y² = x³ + b
|
||||
y2 := new(big.Int).Mul(y, y) //y²
|
||||
y2.Mod(y2, BitCurve.P) //y²%P
|
||||
y2 := new(big.Int).Mul(y, y) // y²
|
||||
y2.Mod(y2, BitCurve.P) // y²%P
|
||||
|
||||
x3 := new(big.Int).Mul(x, x) //x²
|
||||
x3.Mul(x3, x) //x³
|
||||
x3 := new(big.Int).Mul(x, x) // x²
|
||||
x3.Mul(x3, x) // x³
|
||||
|
||||
x3.Add(x3, BitCurve.B) //x³+B
|
||||
x3.Add(x3, BitCurve.B) // x³+B
|
||||
x3.Mod(x3, BitCurve.P) //(x³+B)%P
|
||||
|
||||
return x3.Cmp(y2) == 0
|
||||
}
|
||||
|
||||
//TODO: double check if the function is okay
|
||||
// TODO: double check if the function is okay
|
||||
// affineFromJacobian reverses the Jacobian transform. See the comment at the
|
||||
// top of the file.
|
||||
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
|
||||
@@ -217,30 +217,30 @@ func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
|
||||
func (BitCurve *BitCurve) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) {
|
||||
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
|
||||
|
||||
a := new(big.Int).Mul(x, x) //X1²
|
||||
b := new(big.Int).Mul(y, y) //Y1²
|
||||
c := new(big.Int).Mul(b, b) //B²
|
||||
a := new(big.Int).Mul(x, x) // X1²
|
||||
b := new(big.Int).Mul(y, y) // Y1²
|
||||
c := new(big.Int).Mul(b, b) // B²
|
||||
|
||||
d := new(big.Int).Add(x, b) //X1+B
|
||||
d := new(big.Int).Add(x, b) // X1+B
|
||||
d.Mul(d, d) //(X1+B)²
|
||||
d.Sub(d, a) //(X1+B)²-A
|
||||
d.Sub(d, c) //(X1+B)²-A-C
|
||||
d.Mul(d, big.NewInt(2)) //2*((X1+B)²-A-C)
|
||||
d.Mul(d, big.NewInt(2)) // 2*((X1+B)²-A-C)
|
||||
|
||||
e := new(big.Int).Mul(big.NewInt(3), a) //3*A
|
||||
f := new(big.Int).Mul(e, e) //E²
|
||||
e := new(big.Int).Mul(big.NewInt(3), a) // 3*A
|
||||
f := new(big.Int).Mul(e, e) // E²
|
||||
|
||||
x3 := new(big.Int).Mul(big.NewInt(2), d) //2*D
|
||||
x3.Sub(f, x3) //F-2*D
|
||||
x3 := new(big.Int).Mul(big.NewInt(2), d) // 2*D
|
||||
x3.Sub(f, x3) // F-2*D
|
||||
x3.Mod(x3, BitCurve.P)
|
||||
|
||||
y3 := new(big.Int).Sub(d, x3) //D-X3
|
||||
y3.Mul(e, y3) //E*(D-X3)
|
||||
y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) //E*(D-X3)-8*C
|
||||
y3 := new(big.Int).Sub(d, x3) // D-X3
|
||||
y3.Mul(e, y3) // E*(D-X3)
|
||||
y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) // E*(D-X3)-8*C
|
||||
y3.Mod(y3, BitCurve.P)
|
||||
|
||||
z3 := new(big.Int).Mul(y, z) //Y1*Z1
|
||||
z3.Mul(big.NewInt(2), z3) //3*Y1*Z1
|
||||
z3 := new(big.Int).Mul(y, z) // Y1*Z1
|
||||
z3.Mul(big.NewInt(2), z3) // 3*Y1*Z1
|
||||
z3.Mod(z3, BitCurve.P)
|
||||
|
||||
return x3, y3, z3
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build dummy
|
||||
// +build dummy
|
||||
|
||||
// Package c contains only a C file.
|
||||
|
||||
@@ -48,7 +48,7 @@ func randSig() []byte {
|
||||
// tests for malleability
|
||||
// highest bit of signature ECDSA s value must be 0, in the 33th byte
|
||||
func compactSigCheck(t *testing.T, sig []byte) {
|
||||
var b = int(sig[32])
|
||||
b := int(sig[32])
|
||||
if b < 0 {
|
||||
t.Errorf("highest bit is negative: %d", b)
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/errors"
|
||||
)
|
||||
|
||||
var _ cryptotypes.PrivKey = &PrivKey{}
|
||||
var _ codec.AminoMarshaler = &PrivKey{}
|
||||
var (
|
||||
_ cryptotypes.PrivKey = &PrivKey{}
|
||||
_ codec.AminoMarshaler = &PrivKey{}
|
||||
)
|
||||
|
||||
const (
|
||||
PrivKeySize = 32
|
||||
@@ -138,8 +140,10 @@ func GenPrivKeyFromSecret(secret []byte) *PrivKey {
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
var _ cryptotypes.PubKey = &PubKey{}
|
||||
var _ codec.AminoMarshaler = &PubKey{}
|
||||
var (
|
||||
_ cryptotypes.PubKey = &PubKey{}
|
||||
_ codec.AminoMarshaler = &PubKey{}
|
||||
)
|
||||
|
||||
// PubKeySize is comprised of 32 bytes for one field element
|
||||
// (the x-coordinate), plus one byte for the parity of the y-coordinate.
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func Test_genPrivKey(t *testing.T) {
|
||||
|
||||
empty := make([]byte, 32)
|
||||
oneB := big.NewInt(1).Bytes()
|
||||
onePadded := make([]byte, 32)
|
||||
|
||||
@@ -41,7 +41,7 @@ func TestPubKeySecp256k1Address(t *testing.T) {
|
||||
addrBbz, _, _ := base58.CheckDecode(d.addr)
|
||||
addrB := crypto.Address(addrBbz)
|
||||
|
||||
var priv = secp256k1.PrivKey{Key: privB}
|
||||
priv := secp256k1.PrivKey{Key: privB}
|
||||
|
||||
pubKey := priv.PubKey()
|
||||
pubT, _ := pubKey.(*secp256k1.PubKey)
|
||||
|
||||
@@ -44,7 +44,6 @@ func ExamplePrintRegisteredTypes() {
|
||||
}
|
||||
|
||||
func TestNilEncodings(t *testing.T) {
|
||||
|
||||
// Check nil Signature.
|
||||
var a, b []byte
|
||||
checkAminoJSON(t, &a, &b, true)
|
||||
@@ -59,5 +58,4 @@ func TestNilEncodings(t *testing.T) {
|
||||
var e, f cryptotypes.PrivKey
|
||||
checkAminoJSON(t, &e, &f, true)
|
||||
require.EqualValues(t, e, f)
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
type LedgerSECP256K1Mock struct {
|
||||
}
|
||||
type LedgerSECP256K1Mock struct{}
|
||||
|
||||
func (mock LedgerSECP256K1Mock) Close() error {
|
||||
return nil
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build cgo && ledger && !test_ledger_mock
|
||||
// +build cgo,ledger,!test_ledger_mock
|
||||
|
||||
package ledger
|
||||
|
||||
@@ -14,11 +14,9 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
)
|
||||
|
||||
var (
|
||||
// discoverLedger defines a function to be invoked at runtime for discovering
|
||||
// a connected Ledger device.
|
||||
discoverLedger discoverLedgerFn
|
||||
)
|
||||
// discoverLedger defines a function to be invoked at runtime for discovering
|
||||
// a connected Ledger device.
|
||||
var discoverLedger discoverLedgerFn
|
||||
|
||||
type (
|
||||
// discoverLedgerFn defines a Ledger discovery function that returns a
|
||||
@@ -102,8 +100,7 @@ func (pkl PrivKeyLedgerSecp256k1) Sign(message []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
// ShowAddress triggers a ledger device to show the corresponding address.
|
||||
func ShowAddress(path hd.BIP44Params, expectedPubKey types.PubKey,
|
||||
accountAddressPrefix string) error {
|
||||
func ShowAddress(path hd.BIP44Params, expectedPubKey types.PubKey, accountAddressPrefix string) error {
|
||||
device, err := getDevice()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -67,7 +67,6 @@ func TestBitArrayEqual(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJSONMarshalUnmarshal(t *testing.T) {
|
||||
|
||||
bA1 := NewCompactBitArray(0)
|
||||
bA2 := NewCompactBitArray(1)
|
||||
|
||||
@@ -218,7 +217,6 @@ func TestCompactBitArrayNumOfTrueBitsBefore(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := 0; i < len(tc.bAIndex); i++ {
|
||||
|
||||
require.Equal(t, tc.trueValueIndex[i], bA.NumTrueBitsBefore(tc.bAIndex[i]), "tc %d, i %d", tcIndex, i)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -10,8 +10,10 @@ import (
|
||||
|
||||
// TODO, make this into a struct that implements crypto.Symmetric.
|
||||
|
||||
const nonceLen = 24
|
||||
const secretLen = 32
|
||||
const (
|
||||
nonceLen = 24
|
||||
secretLen = 32
|
||||
)
|
||||
|
||||
// secret must be 32 bytes long. Use something like Sha256(Bcrypt(passphrase))
|
||||
// The ciphertext is (secretbox.Overhead + 24) bytes longer than the plaintext.
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
)
|
||||
|
||||
func TestSimple(t *testing.T) {
|
||||
|
||||
plaintext := []byte("sometext")
|
||||
secret := []byte("somesecretoflengththirtytwo===32")
|
||||
ciphertext := EncryptSymmetric(plaintext, secret)
|
||||
@@ -22,7 +21,6 @@ func TestSimple(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSimpleWithKDF(t *testing.T) {
|
||||
|
||||
plaintext := []byte("sometext")
|
||||
secretPass := []byte("somesecret")
|
||||
secret, err := bcrypt.GenerateFromPassword(secretPass, 12)
|
||||
|
||||
Reference in New Issue
Block a user