works OMG YESH
This commit is contained in:
parent
f2d854d88f
commit
f4a6988f11
@ -24,10 +24,10 @@ func TestSeedToKeypair(t *testing.T) {
|
|||||||
func TestSign(t *testing.T) {
|
func TestSign(t *testing.T) {
|
||||||
|
|
||||||
msgid := "<wut@wut.wut>"
|
msgid := "<wut@wut.wut>"
|
||||||
seed := randbytes(32)
|
var seed [32]byte
|
||||||
pk, sec := naclSeedToKeyPair(seed)
|
pk, sec := naclSeedToKeyPair(seed[:])
|
||||||
sig := msgidFrontendSign(sec, msgid)
|
sig := msgidFrontendSign(sec, msgid)
|
||||||
t.Log(sig)
|
t.Logf("seed=%s pk=%s sk=%s sig=%s", hexify(seed[:]), hexify(pk), hexify(sec), sig)
|
||||||
if !verifyFrontendSig(hexify(pk), sig, msgid) {
|
if !verifyFrontendSig(hexify(pk), sig, msgid) {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ func naclSeedToKeyPair(seed []byte) (pk, sk []byte) {
|
|||||||
sk[31] |= 64
|
sk[31] |= 64
|
||||||
// scalarmult magick shit
|
// scalarmult magick shit
|
||||||
pk = scalarBaseMult(sk[0:32])
|
pk = scalarBaseMult(sk[0:32])
|
||||||
|
copy(sk[0:32], seed[0:32])
|
||||||
copy(sk[32:64], pk[0:32])
|
copy(sk[32:64], pk[0:32])
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user