mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete * 2.1.0 main node rollup
29 lines
633 B
Go
29 lines
633 B
Go
// -*- go -*-
|
|
|
|
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"crypto/cipher/gcm"
|
|
)
|
|
|
|
func main(a, b byte) (string, int) {
|
|
key := []byte{
|
|
0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
|
|
0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06,
|
|
}
|
|
nonce := []byte{
|
|
0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
|
|
0xb4, 0x22, 0xda, 0x80,
|
|
}
|
|
plain := []byte("Single block msgSingle block msg")
|
|
additional := []byte("additional data to be authenticated")
|
|
|
|
c := gcm.EncryptAES128(key, nonce, plain, additional)
|
|
p, ok := gcm.DecryptAES128(key, nonce, c, additional)
|
|
if !ok {
|
|
return "Open failed", 0
|
|
}
|
|
return string(p), bytes.Compare(plain, p)
|
|
}
|