Last active
December 10, 2024 14:36
-
-
Save dcb9/a9936b59c1d9cd8a08ff874ca734e8c9 to your computer and use it in GitHub Desktop.
Revisions
-
Du, Chengbin revised this gist
May 22, 2024 . No changes.There are no files selected for viewing
-
Du, Chengbin revised this gist
May 22, 2024 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import ( "fmt" "github.com/babylonchain/babylon/crypto/eots" ) func main() { @@ -15,15 +14,15 @@ func main() { privateRand, publicRand, _ := eots.RandGen(rand.Reader) // sign for message 1 h1 := []byte("hello") s1, _ := eots.Sign(secretKey, privateRand, h1) // sign for message 2 h2 := []byte("world") s2, _ := eots.Sign(secretKey, privateRand, h2) // extract private key extractedKey, _ := eots.Extract(publicKey, publicRand, h1, s1, h2, s2) fmt.Println(" original secret key:", secretKey) fmt.Println("extracted secret key:", extractedKey) } -
Du, Chengbin revised this gist
May 22, 2024 . No changes.There are no files selected for viewing
-
Du, Chengbin created this gist
May 22, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ package main import ( "crypto/rand" "fmt" "github.com/babylonchain/babylon/crypto/eots" "github.com/btcsuite/btcd/chaincfg/chainhash" ) func main() { // Generate keys secretKey, _ := eots.KeyGen(rand.Reader) publicKey := eots.PubGen(secretKey) privateRand, publicRand, _ := eots.RandGen(rand.Reader) // sign for message 1 h1 := chainhash.HashB([]byte("hello")) s1, _ := eots.Sign(secretKey, privateRand, h1) // sign for message 2 h2 := chainhash.HashB([]byte("world")) s2, _ := eots.Sign(secretKey, privateRand, h2) // extract private key extractedKey, _ := eots.Extract(publicKey, publicRand, h1, s1, h2, s2) fmt.Println(" original secret key:", secretKey) fmt.Println("extracted secret key:", extractedKey) }