Browse Source

RLWE: Ring Learning With Errors

master
vkumar 10 months ago
commit
843a9a31ad
5 changed files with 1529 additions and 0 deletions
  1. 15
    0
      README.md
  2. 53
    0
      manual_test/manual.go
  3. 54
    0
      random_linux.go
  4. 796
    0
      rlwe.go
  5. 611
    0
      rlwe_test.go

+ 15
- 0
README.md View File

@@ -0,0 +1,15 @@
# RLWE : Ring Learning With Errors

This go package implements the RLWE ( Ring learning with errors) a Lattice based Key Exchange.

The algorithm is safe from quantum computer attacks. ( Since it is not based on factoring problem)
This implementation is a non-constant time Gaussian based RLWE with params **n = 1024 q=40961**
The above parameters have been proved to deliver **minimal 2^256 bit security, upper limit not yet found.**





You can read more at https://en.wikipedia.org/wiki/Ring_learning_with_errors

Why n= 1024 & q=40961 can be found at http://www.ringlwe.info/parameters-for-rlwe.html

+ 53
- 0
manual_test/manual.go View File

@@ -0,0 +1,53 @@

package main

import "fmt"
import "rlwe"

func main() {
fmt.Printf("Init RWLE\n")

/*Exclusively For Alice*/
var s_alice [2 * rlwe.M]rlwe.RINGELT /* Alice's Private Key */
var mu_alice [rlwe.Muwords]uint64 /* Alice's recovered mu */

/*Exclusively For Bob*/
var mu_bob [rlwe.Muwords]uint64 /* Bob's version of mu */

/*Information that gets shared by Alice and Bob*/
var b_alice [rlwe.M]rlwe.RINGELT /* Alice's Public Key */
var u [rlwe.M]rlwe.RINGELT /* Bob's Ring Element from Encapsulation */
var cr_v [rlwe.Muwords]uint64 /* Cross Rounding of v */

/*for i:=0 ; i < 100;i++{
fmt.Printf("%4d: %d\n",i,RANDOM8())
}*/

rlwe.KEM1_Generate(&s_alice, &b_alice)
// KEM1_Generate(s_alice,b_alice)

for i := 1000; i < 1024; i++ {
fmt.Printf("%4d: %8d %8d %d %d\n", i, s_alice[i], s_alice[i+1024], b_alice[i], len(s_alice))
}

fmt.Printf("Keys initialised\n")

public_alice := b_alice[:1024]

rlwe.KEM1_Encapsulate(&u, &cr_v, &mu_bob, public_alice)

/* for i:=0 ; i < 16;i++{
fmt.Printf("%4d: %d %d %dx\n",i,u[i],cr_v[i],mu_bob[i])
}
*/

private_alice := s_alice[1024:]
u_copy := u[:]
rlwe.KEM1_Decapsulate(&mu_alice, u_copy, private_alice, cr_v)

for i := 0; i < 16; i++ {
fmt.Printf("%4d: %d %d \n", i, mu_bob[i], mu_alice[i])
}

}

+ 54
- 0
random_linux.go View File

@@ -0,0 +1,54 @@



// +build linux !freebsd !cgo

/* this file implements the RNG,
please don't use OS based RNG and don't use RDSEED , processor based RNG generator
The current function is just a placeholder and must be replaced before this code goes into production
TAGS are used so as this file is not used, and should be replaced
Any attempt to cross-compile would cause this file to be skipped and thus the RND gen fixed
*/
package rlwe

import "time"
import "crypto/rand"


var x uint64 /* The state must be seeded with a nonzero value. */

func init(){
x = uint64(time.Now().UTC().UnixNano()) // asumming we only 20 bits of entry, since time can be guessed
z:= x % 1024
z += 41

buf := make([]byte, z)
_, err := rand.Read(buf)
if err != nil {
panic("error: initialing RNG generator")
return
}

for i := uint64(0); i < z ; i++{
x ^= x >> buf[i]&63 // a
x ^= x << 25 // b
x ^= x >> buf[i]&63 // c

xorshift64star()
}

// now lets mix in os rnd generator for time being
}

func xorshift64star() uint64 {
x ^= x >> 12 // a
x ^= x << 25 // b
x ^= x >> 27 // c
return x * uint64(2685821657736338717)
}

/* this function generates a uint64 RNG */
func Random_Safe_uint64() uint64 {
return xorshift64star()
}

+ 796
- 0
rlwe.go
File diff suppressed because it is too large
View File


+ 611
- 0
rlwe_test.go View File

@@ -0,0 +1,611 @@
// This file implements testing of rlwe
// this file also implements a pseudo RNG for testing purposes

package rlwe

import "testing"




/* this function tests the rwle implementation using test vector
this function only test n = 1024 q= 40961 vectors*/
func Test_rlwe_testvector(t *testing.T) {

b_alice_test := [1024]RINGELT{
0x3EE6, 0x5616, 0x30F6, 0x0679, 0x333D, 0x631D, 0x44D5, 0x9B7A,
0x81CD, 0x1BFB, 0x2276, 0x364C, 0x1AA3, 0x2F71, 0x4C13, 0x68E3,
0x9D41, 0x1A32, 0x09E1, 0x7EED, 0x5BAC, 0x7F5A, 0x3AF3, 0x6259,
0x6F62, 0x593D, 0x0687, 0x17DB, 0x05DA, 0x3B9C, 0x3AA1, 0x394E,
0x8F0E, 0x0407, 0x8401, 0x077A, 0x9458, 0x83FB, 0x4D30, 0x3896,
0x829E, 0x7ADA, 0x9C45, 0x1E19, 0x9D7C, 0x721E, 0x044B, 0x63FC,
0x21B6, 0x8008, 0x6410, 0x23DD, 0x9FAD, 0x8A45, 0x3516, 0x0563,
0x2966, 0x47B3, 0x2E7F, 0x8522, 0x1DC2, 0x0DC3, 0x4FBE, 0x35BA,
0x21FF, 0x4172, 0x0DA2, 0x64A1, 0x83C9, 0x2703, 0x1575, 0x26B8,
0x906A, 0x2284, 0x62C7, 0x5292, 0x8AFE, 0x550E, 0x7A8E, 0x69C9,
0x60BF, 0x5931, 0x8D9D, 0x1280, 0x6718, 0x224B, 0x0CAD, 0x5654,
0x3643, 0x678F, 0x6B4E, 0x4E96, 0x746B, 0x8A4E, 0x10CA, 0x530D,
0x1831, 0x2D5A, 0x8EEF, 0x9664, 0x67D6, 0x8F0E, 0x8DBD, 0x280F,
0x6585, 0x910D, 0x0CAD, 0x44C9, 0x307F, 0x572C, 0x7CE2, 0x7507,
0x1D8B, 0x6EDA, 0x20BE, 0x9E5D, 0x144D, 0x6ED6, 0x4432, 0x4A42,
0x721F, 0x98A4, 0x1000, 0x9C65, 0x591C, 0x7900, 0x0C26, 0x7385,
0x031D, 0x81B9, 0x464E, 0x627E, 0x80BF, 0x674D, 0x5772, 0x4DED,
0x10F6, 0x5048, 0x823F, 0x6713, 0x85E2, 0x0DB9, 0x7876, 0x707E,
0x128B, 0x513D, 0x3EE4, 0x42A8, 0x9B2C, 0x6774, 0x1163, 0x8AEA,
0x3B49, 0x9D90, 0x3576, 0x81E8, 0x6D45, 0x5A68, 0x2DE5, 0x3DC6,
0x7065, 0x3E47, 0x7704, 0x11B2, 0x4D23, 0x8238, 0x06E1, 0x11EE,
0x8710, 0x8F9C, 0x9492, 0x5EB7, 0x38FD, 0x9EEE, 0x074C, 0x42F5,
0x57E9, 0x836E, 0x4819, 0x7F34, 0x7244, 0x550D, 0x13F2, 0x6998,
0x2C6D, 0x9A61, 0x9C1D, 0x7010, 0x9F5B, 0x3909, 0x3294, 0x55D7,
0x0712, 0x2911, 0x8684, 0x1EF3, 0x9BA1, 0x4456, 0x8363, 0x8D3F,
0x38E0, 0x9D00, 0x77BB, 0x1EF7, 0x09B6, 0x1E1A, 0x7592, 0x3F37,
0x63AF, 0x195B, 0x9324, 0x497D, 0x5290, 0x3F9F, 0x01D8, 0x09EB,
0x67B5, 0x17C8, 0x5AAB, 0x3C90, 0x9F75, 0x2F61, 0x6FAE, 0x1CAC,
0x5FFD, 0x5F0F, 0x0E25, 0x5ACC, 0x81AE, 0x9D80, 0x45EF, 0x7A60,
0x8398, 0x0A97, 0x3B1C, 0x31AC, 0x6578, 0x7B60, 0x1C05, 0x2561,
0x787F, 0x499E, 0x2945, 0x4E8D, 0x8673, 0x97F5, 0x202C, 0x5306,
0x0ED7, 0x9784, 0x759E, 0x6B3A, 0x7191, 0x0ABD, 0x1FED, 0x4B3C,
0x87FD, 0x9601, 0x08E5, 0x2911, 0x96C8, 0x2FE2, 0x41D8, 0x6EEA,
0x3E47, 0x7BD4, 0x4252, 0x613E, 0x2B0D, 0x852C, 0x9F25, 0x8F2C,
0x1DB7, 0x88EB, 0x836B, 0x4D7C, 0x1E3F, 0x548E, 0x3242, 0x358D,
0x0E11, 0x1759, 0x4A6B, 0x705F, 0x9296, 0x1C73, 0x87FD, 0x01FD,
0x90D6, 0x963B, 0x7FD0, 0x534B, 0x637A, 0x9119, 0x5C28, 0x407D,
0x661A, 0x314F, 0x008A, 0x3064, 0x2D06, 0x8372, 0x767F, 0x4618,
0x3B1B, 0x5477, 0x34B6, 0x7ECD, 0x3E79, 0x097E, 0x1A86, 0x5549,
0x567E, 0x6A2A, 0x7DA9, 0x7F09, 0x25DD, 0x8F40, 0x7E3E, 0x8CE0,
0x374C, 0x6BF2, 0x9652, 0x2C0E, 0x70A9, 0x6F77, 0x9B42, 0x2666,
0x2B18, 0x361F, 0x021D, 0x260C, 0x15C4, 0x6246, 0x31B3, 0x789C,
0x94E0, 0x339C, 0x0EC9, 0x27F3, 0x9D04, 0x0CEE, 0x4ED0, 0x424E,
0x3688, 0x138F, 0x8C92, 0x0AD3, 0x5CB3, 0x1250, 0x70A1, 0x016E,
0x2843, 0x0B4D, 0x48D1, 0x389E, 0x5321, 0x6738, 0x2C17, 0x281C,
0x0A2C, 0x1AD4, 0x6490, 0x80AB, 0x0D60, 0x0992, 0x7E91, 0x4A98,
0x3916, 0x7DBD, 0x1364, 0x7DDC, 0x8C9F, 0x5394, 0x89A4, 0x4A79,
0x29D5, 0x03C7, 0x2C86, 0x4A98, 0x4069, 0x4ABD, 0x40C5, 0x5742,
0x5A52, 0x8508, 0x59B3, 0x172D, 0x26CB, 0x846D, 0x4724, 0x9BDA,
0x5D5A, 0x652B, 0x0A24, 0x1049, 0x25BC, 0x5740, 0x0D41, 0x161A,
0x0A78, 0x7B6D, 0x1C91, 0x202B, 0x98AE, 0x4310, 0x4128, 0x29D4,
0x0B8A, 0x9220, 0x8AAA, 0x28EC, 0x5E4C, 0x7B20, 0x4577, 0x1097,
0x4E61, 0x8CC6, 0x8651, 0x245A, 0x8A04, 0x4073, 0x7AAF, 0x61CA,
0x37E0, 0x11DB, 0x4021, 0x472E, 0x3DBB, 0x1F4A, 0x6126, 0x0670,
0x7FCE, 0x9195, 0x390C, 0x4DEB, 0x972F, 0x5816, 0x2950, 0x7543,
0x95D5, 0x1AA8, 0x47AD, 0x2AC8, 0x1E4F, 0x91C3, 0x1CA2, 0x0ABC,
0x9E3B, 0x1D54, 0x18D4, 0x3874, 0x2817, 0x2BCF, 0x8E48, 0x820B,
0x0669, 0x6B76, 0x659D, 0x070B, 0x9E9E, 0x378F, 0x6551, 0x6176,
0x4759, 0x3472, 0x938C, 0x6795, 0x6BB4, 0x9912, 0x1415, 0x4387,
0x5814, 0x57D3, 0x36DB, 0x8E4C, 0x5267, 0x15FB, 0x9571, 0x4EAB,
0x54E1, 0x7281, 0x9F01, 0x20DB, 0x5D23, 0x6846, 0x1D7B, 0x261F,
0x6735, 0x5577, 0x47E8, 0x67D4, 0x659F, 0x6459, 0x166B, 0x5B4E,
0x3D97, 0x4E57, 0x20CA, 0x706A, 0x5D4B, 0x9AC7, 0x0A32, 0x2FAA,
0x8203, 0x7003, 0x73F6, 0x3023, 0x4BA0, 0x3F35, 0x0551, 0x30E5,
0x38BF, 0x4C91, 0x6322, 0x37B4, 0x22AE, 0x7A9A, 0x798A, 0x0DFF,
0x72C9, 0x81D3, 0x29EF, 0x8FF6, 0x9009, 0x787F, 0x4B60, 0x253A,
0x1BEC, 0x773A, 0x7B9B, 0x1E27, 0x0094, 0x070E, 0x6615, 0x7FB6,
0x2AB1, 0x7E5B, 0x22BE, 0x5D7D, 0x5A1D, 0x29F0, 0x1FA7, 0x8D12,
0x910F, 0x2A0B, 0x46F0, 0x2D54, 0x95B2, 0x4A15, 0x4A8F, 0x22CA,
0x7E6E, 0x11E2, 0x1F55, 0x1C2C, 0x08FB, 0x9CBF, 0x0A05, 0x983E,
0x47F8, 0x1D54, 0x4ED4, 0x40D4, 0x9EE2, 0x753F, 0x75E3, 0x9F55,
0x0240, 0x19A3, 0x6BCE, 0x64C3, 0x1F02, 0x5467, 0x7124, 0x7A9A,
0x5A77, 0x2351, 0x7160, 0x46A8, 0x2EA9, 0x9291, 0x7F5D, 0x0C1A,
0x323C, 0x0EC6, 0x626D, 0x467A, 0x4585, 0x459E, 0x640E, 0x694A,
0x0A59, 0x1A50, 0x055D, 0x5159, 0x0E59, 0x7C5B, 0x4EEB, 0x42F9,
0x7557, 0x77C0, 0x54D3, 0x51E2, 0x2DEE, 0x7220, 0x5F62, 0x479D,
0x9020, 0x1A4A, 0x405D, 0x8E13, 0x5A0A, 0x703C, 0x272F, 0x0782,
0x1EB7, 0x47A2, 0x5A61, 0x5D08, 0x223F, 0x72B5, 0x9367, 0x87A6,
0x6848, 0x84E7, 0x8E59, 0x0727, 0x7E16, 0x1B10, 0x7B29, 0x77A8,
0x7DF2, 0x2362, 0x3850, 0x370B, 0x2D03, 0x4292, 0x7E56, 0x617A,
0x1FC0, 0x5AB4, 0x0FEB, 0x1C89, 0x3EED, 0x67FD, 0x7E19, 0x3A86,
0x560F, 0x9B41, 0x895F, 0x02B2, 0x0DE1, 0x8504, 0x1C99, 0x9076,
0x56F1, 0x5218, 0x34E9, 0x43E1, 0x93A1, 0x3CD1, 0x6DF3, 0x215C,
0x30B8, 0x2C26, 0x83F4, 0x6EB6, 0x6B40, 0x6B40, 0x4406, 0x8AB8,
0x8E52, 0x1DCD, 0x508E, 0x08A7, 0x74ED, 0x4B65, 0x4C09, 0x0BA6,
0x1B8C, 0x90A1, 0x0BF5, 0x8CCF, 0x56C6, 0x4974, 0x5F51, 0x3ED2,
0x557C, 0x8FCA, 0x76C3, 0x2E9B, 0x7067, 0x8788, 0x5362, 0x1972,
0x2B12, 0x262F, 0x90BF, 0x269D, 0x93FA, 0x85A5, 0x58B9, 0x7284,
0x47D5, 0x1833, 0x93F9, 0x8269, 0x069D, 0x74D5, 0x9E42, 0x938F,
0x94FA, 0x968F, 0x2263, 0x989F, 0x80CB, 0x5308, 0x9385, 0x2EFD,
0x944B, 0x2869, 0x7EE9, 0x18C2, 0x1088, 0x92DE, 0x0AD9, 0x9BDD,
0x1898, 0x62CF, 0x90DE, 0x6490, 0x9D6A, 0x82C3, 0x9746, 0x3570,
0x297F, 0x4DB3, 0x1717, 0x12E6, 0x1CEF, 0x2790, 0x6DBA, 0x3AA0,
0x3DF2, 0x02EF, 0x4330, 0x6371, 0x868C, 0x5AC0, 0x8578, 0x7E48,
0x8D08, 0x35CA, 0x4735, 0x54A3, 0x0662, 0x2F8A, 0x484E, 0x9019,
0x44AA, 0x5A23, 0x71E9, 0x4589, 0x5A06, 0x4F07, 0x0662, 0x4AE3,
0x8930, 0x5AD7, 0x41E0, 0x1297, 0x2A8C, 0x7BB9, 0x5197, 0x7D41,
0x6F38, 0x0C08, 0x4D3E, 0x7A09, 0x7570, 0x4823, 0x45BD, 0x0E0C,
0x7470, 0x588F, 0x4B7C, 0x6F05, 0x69FB, 0x8F14, 0x4598, 0x1F95,
0x7CA1, 0x2627, 0x9602, 0x0A69, 0x8678, 0x44B0, 0x8C53, 0x2067,
0x2BF6, 0x9BF8, 0x489F, 0x4EDC, 0x8D9B, 0x10EA, 0x98B1, 0x9AAB,
0x0B01, 0x48F3, 0x0272, 0x42AA, 0x8FCF, 0x70E8, 0x5267, 0x9B1E,
0x3E4A, 0x5E54, 0x87A8, 0x7B9F, 0x1618, 0x145F, 0x3A15, 0x7B84,
0x5A94, 0x88D7, 0x9552, 0x4231, 0x8982, 0x8409, 0x0869, 0x8DE4,
0x0A87, 0x96E5, 0x2364, 0x2C35, 0x48FB, 0x0CA6, 0x85CA, 0x4A1D,
0x4843, 0x5CDF, 0x1499, 0x42E7, 0x79B7, 0x0796, 0x8DB4, 0x8F1B,
0x851F, 0x8D2E, 0x1385, 0x9FAA, 0x5E26, 0x84B3, 0x9A08, 0x3A36,
0x57E6, 0x54A0, 0x0578, 0x425F, 0x7966, 0x81F0, 0x5EB4, 0x20AA,
0x4FF7, 0x34BE, 0x1AB3, 0x22B2, 0x6BEB, 0x6F2D, 0x0B33, 0x360C,
0x78C2, 0x26DC, 0x3BA0, 0x1B8D, 0x60EA, 0x87A2, 0x0802, 0x0AA6,
0x8A9C, 0x2625, 0x44D1, 0x8DC2, 0x1A88, 0x30E9, 0x7397, 0x6888,
0x550D, 0x1F7D, 0x47CF, 0x2FCE, 0x3F5E, 0x6B2B, 0x7B63, 0x30E5,
0x5E9E, 0x63D1, 0x0E07, 0x95A1, 0x4121, 0x354D, 0x77C8, 0x1A05,
0x75C5, 0x9F66, 0x0225, 0x4362, 0x4C8C, 0x952C, 0x36C5, 0x1599,
0x1CFA, 0x26AD, 0x1972, 0x9F09, 0x4AB2, 0x5F02, 0x5CFB, 0x6634,
0x7416, 0x7713, 0x14A9, 0x32A0, 0x8E71, 0x0188, 0x5B95, 0x77CA,
0x5BB1, 0x2E12, 0x76C4, 0x8080, 0x7B8F, 0x2362, 0x58CA, 0x9012,
0x1733, 0x5C83, 0x0580, 0x7A63, 0x5261, 0x1D93, 0x490F, 0x9C50,
0x8A5B, 0x2AE4, 0x1376, 0x0EC7, 0x8CBB, 0x1893, 0x3768, 0x19A0,
0x75D3, 0x7A87, 0x6F1F, 0x75E5, 0x7546, 0x1836, 0x09E2, 0x2550,
0x697C, 0x4335, 0x8107, 0x5DA2, 0x1DE8, 0x21B8, 0x446D, 0x84AF,
0x479A, 0x6B41, 0x543F, 0x4F6A, 0x6F79, 0x1A15, 0x1BA0, 0x9CAA,
0x182F, 0x08E1, 0x8B34, 0x6793, 0x4D26, 0x4CCC, 0x741F, 0x5FAA,
0x0E4A, 0x6D3B, 0x5C2F, 0x6A39, 0x8F49, 0x9518, 0x699A, 0x28B5,
0x6CBD, 0x0012, 0x3592, 0x6B91, 0x7D0D, 0x3747, 0x5DC4, 0x8811,
0x2FA6, 0x6983, 0x65C0, 0x269D, 0x8AA8, 0x4EC6, 0x95F3, 0x0BD7,
0x8A90, 0x1F94, 0x788B, 0x87DA, 0x1E44, 0x77BC, 0x89D1, 0x03DF,
0x7686, 0x15ED, 0x8BB1, 0x5228, 0x3703, 0x34C4, 0x99C4, 0x25EB,
}

//noise
s0_alice_test := [1024]RINGELT{
0x0AD6, 0x3393, 0x569B, 0x11A0, 0x2987, 0x87A5, 0x6F6A, 0x5A7A,
0x04DF, 0x0C75, 0x6B83, 0x0406, 0x9622, 0x3704, 0x14EE, 0x032B,
0x498D, 0x8E3B, 0x8ADE, 0x7A27, 0x11D5, 0x797A, 0x35BF, 0x3464,
0x3878, 0x21D6, 0x2679, 0x9DC6, 0x6D16, 0x2EB5, 0x9098, 0x32A0,
0x8508, 0x8A21, 0x9346, 0x9B22, 0x99E7, 0x070C, 0x54F3, 0x5974,
0x2632, 0x8B17, 0x6C8C, 0x72B2, 0x1E18, 0x256E, 0x0348, 0x0156,
0x5390, 0x5B3A, 0x5F02, 0x053A, 0x80A3, 0x01E6, 0x9BAA, 0x2C50,
0x4ECB, 0x806A, 0x5D84, 0x46B2, 0x7FBE, 0x8E79, 0x9317, 0x3AF2,
0x9A4A, 0x455F, 0x076A, 0x9BB0, 0x5A6F, 0x549E, 0x40EF, 0x3BD4,
0x863B, 0x7B2E, 0x14CA, 0x154F, 0x22A2, 0x58D6, 0x3531, 0x1087,
0x9F21, 0x52AE, 0x0D5E, 0x9410, 0x97FA, 0x4AB6, 0x4413, 0x2C04,
0x8C64, 0x4477, 0x5097, 0x8607, 0x2293, 0x4EAF, 0x9397, 0x502B,
0x956F, 0x7006, 0x6FCE, 0x279C, 0x41D1, 0x32D2, 0x8759, 0x1194,
0x6A4B, 0x9691, 0x141E, 0x084B, 0x9D38, 0x9504, 0x13DF, 0x3CD0,
0x25B8, 0x9413, 0x00C4, 0x2AA8, 0x6485, 0x3AC0, 0x48F1, 0x2521,
0x65FD, 0x69DF, 0x0A70, 0x83F3, 0x6227, 0x0C8F, 0x4B1F, 0x67A5,
0x59AF, 0x5281, 0x5A5F, 0x3C39, 0x58A8, 0x9ABF, 0x11ED, 0x2523,
0x779E, 0x758F, 0x7B45, 0x16CC, 0x6D2A, 0x8A56, 0x189B, 0x3626,
0x3DDC, 0x7918, 0x1561, 0x2F28, 0x0106, 0x13C9, 0x14DB, 0x3526,
0x7DAB, 0x1040, 0x82D5, 0x88DE, 0x4B7A, 0x88DA, 0x7B7E, 0x389E,
0x0758, 0x87E8, 0x7EA8, 0x3BC7, 0x58BB, 0x4299, 0x7614, 0x6759,
0x01B5, 0x6EA6, 0x87D5, 0x943A, 0x9C28, 0x8F13, 0x041C, 0x8EE4,
0x02FE, 0x7091, 0x540C, 0x40CF, 0x1E31, 0x843B, 0x0040, 0x5E18,
0x3D2B, 0x1151, 0x484A, 0x5467, 0x734E, 0x42C8, 0x433C, 0x74F4,
0x78D4, 0x9198, 0x0820, 0x4DA7, 0x4142, 0x1ACD, 0x4DE2, 0x6B3A,
0x54EA, 0x7B13, 0x9E55, 0x98B5, 0x6A21, 0x9D43, 0x78B7, 0x9F4D,
0x9DE5, 0x6B79, 0x1EF6, 0x25FD, 0x3AE5, 0x3825, 0x7335, 0x186E,
0x8E97, 0x2DF2, 0x0A20, 0x89C0, 0x2193, 0x80FF, 0x7EF6, 0x2A80,
0x7C16, 0x133D, 0x2F39, 0x0335, 0x9EA8, 0x7714, 0x394F, 0x391F,
0x7143, 0x96C6, 0x9F4B, 0x0694, 0x0591, 0x5970, 0x2452, 0x44A1,
0x5CD1, 0x9F80, 0x6242, 0x7519, 0x36D0, 0x3FA0, 0x10C9, 0x8FC4,
0x92BA, 0x6E65, 0x01FC, 0x7367, 0x5151, 0x5772, 0x713F, 0x8BCB,
0x831F, 0x9DDE, 0x5441, 0x90D1, 0x046D, 0x5404, 0x9C00, 0x88AA,
0x4DA4, 0x376B, 0x98BC, 0x0484, 0x9929, 0x9349, 0x7F02, 0x916D,
0x33D6, 0x63D3, 0x81A6, 0x4EEA, 0x2A88, 0x8150, 0x8800, 0x5CD9,
0x511A, 0x5793, 0x6644, 0x4613, 0x41A9, 0x146A, 0x0A15, 0x803B,
0x9410, 0x4F52, 0x296B, 0x552D, 0x7AA1, 0x08B4, 0x200F, 0x0AD0,
0x475D, 0x4579, 0x5E75, 0x6F59, 0x9167, 0x1518, 0x414B, 0x76B0,
0x7082, 0x6F0E, 0x3949, 0x3916, 0x8A87, 0x92EA, 0x3C1E, 0x298B,
0x377B, 0x6460, 0x7BB4, 0x0D5D, 0x551F, 0x4A58, 0x8FC0, 0x065E,
0x7AE0, 0x5FBE, 0x57CC, 0x0596, 0x3BB7, 0x4683, 0x9B76, 0x6D50,
0x6C81, 0x4CE7, 0x5D56, 0x9A78, 0x4467, 0x3DA0, 0x7C2D, 0x3B63,
0x6A41, 0x3E48, 0x23FA, 0x631F, 0x1069, 0x3585, 0x2197, 0x7604,
0x2B82, 0x3145, 0x32F5, 0x88BB, 0x240A, 0x6AB6, 0x9252, 0x8496,
0x5ADF, 0x1071, 0x9F1E, 0x66D7, 0x6A0C, 0x1F31, 0x602A, 0x7F9A,
0x0A76, 0x6BFA, 0x01F0, 0x422D, 0x7298, 0x98B6, 0x5D59, 0x7C6A,
0x8EBD, 0x619F, 0x9F09, 0x206C, 0x2A57, 0x0A13, 0x95EB, 0x44A4,
0x781C, 0x2529, 0x3951, 0x8173, 0x88BF, 0x99D4, 0x8F90, 0x0CC2,
0x35C7, 0x4F23, 0x869D, 0x4840, 0x2F0E, 0x4526, 0x7674, 0x5144,
0x149F, 0x2DA3, 0x5DC4, 0x190D, 0x044C, 0x0252, 0x73B2, 0x1A8C,
0x46A6, 0x2643, 0x17C0, 0x9240, 0x1552, 0x7B80, 0x43BB, 0x6B2B,
0x45DE, 0x34A1, 0x54BF, 0x5C12, 0x7254, 0x6BBF, 0x9C16, 0x162E,
0x19C7, 0x7D8E, 0x64DF, 0x2FEF, 0x11BD, 0x5482, 0x4162, 0x7817,
0x58B5, 0x3F9D, 0x4DDB, 0x3D23, 0x86F6, 0x6D48, 0x370C, 0x01AC,
0x3652, 0x5834, 0x96CB, 0x05C1, 0x5A9B, 0x650A, 0x1BEC, 0x0C23,
0x39E7, 0x3F30, 0x288F, 0x45EA, 0x4C37, 0x805A, 0x9463, 0x27EF,
0x654F, 0x4DDD, 0x0835, 0x7AE4, 0x7E73, 0x9E37, 0x83D4, 0x3DB4,
0x194B, 0x1063, 0x7B85, 0x89B6, 0x2EAD, 0x98A7, 0x37BE, 0x7495,
0x6C68, 0x4D1B, 0x1EED, 0x409D, 0x26A1, 0x92DD, 0x8F73, 0x0BC7,
0x16B6, 0x0433, 0x7CFF, 0x0238, 0x068E, 0x7526, 0x83C9, 0x6EB3,
0x3B76, 0x7EF2, 0x48DB, 0x0BB1, 0x5EA2, 0x52D3, 0x69B5, 0x1D83,
0x28E9, 0x5A63, 0x6E7C, 0x3032, 0x7AB7, 0x2856, 0x660F, 0x0333,
0x022A, 0x99C9, 0x31B5, 0x18B1, 0x2734, 0x5EA0, 0x8AAF, 0x3CFB,
0x5D69, 0x9472, 0x71EB, 0x48EB, 0x94D8, 0x7A41, 0x12B1, 0x690E,
0x5D51, 0x1B3B, 0x9AF5, 0x5373, 0x54B4, 0x45DD, 0x45A5, 0x8D6E,
0x9217, 0x8183, 0x64A3, 0x989A, 0x2951, 0x1650, 0x4B12, 0x4026,
0x8F4C, 0x596C, 0x72E8, 0x5B07, 0x9533, 0x35E2, 0x01B1, 0x205D,
0x7433, 0x9B4A, 0x779D, 0x6676, 0x0AF8, 0x0D96, 0x432B, 0x170E,
0x102B, 0x21F1, 0x366F, 0x16B9, 0x8688, 0x1F7B, 0x1A70, 0x7A29,
0x2AE6, 0x170F, 0x6E6B, 0x5EF8, 0x49FC, 0x5145, 0x95EE, 0x849B,
0x80F9, 0x04E1, 0x37AF, 0x7492, 0x7D0F, 0x51A0, 0x591E, 0x6D90,
0x0578, 0x0476, 0x6F4E, 0x3A88, 0x4818, 0x830F, 0x7F21, 0x7B94,
0x936C, 0x6BFC, 0x2E03, 0x7BB9, 0x0EFB, 0x97F3, 0x1CD1, 0x9631,
0x4858, 0x60B0, 0x6C71, 0x8484, 0x8C0D, 0x71E8, 0x3A95, 0x6244,
0x1F29, 0x1B12, 0x1E84, 0x4E47, 0x7C57, 0x86C1, 0x1DB1, 0x449E,
0x026C, 0x51A9, 0x8923, 0x8798, 0x24A1, 0x5BAA, 0x55DA, 0x3826,
0x401D, 0x56D2, 0x4282, 0x58EE, 0x3CF0, 0x08E0, 0x53D4, 0x736D,
0x1158, 0x095E, 0x1C0D, 0x49C2, 0x5C7D, 0x93B7, 0x3D2A, 0x6D46,
0x6D0F, 0x2C22, 0x45D6, 0x0D84, 0x2094, 0x4A02, 0x6720, 0x88E0,
0x7A8A, 0x4132, 0x4816, 0x15E1, 0x0BAB, 0x87ED, 0x6A31, 0x957F,
0x78D4, 0x4FDA, 0x625B, 0x6FFE, 0x7DFF, 0x0A54, 0x3D6A, 0x86E4,
0x3EFC, 0x7DB8, 0x4FD2, 0x2E69, 0x8359, 0x3F90, 0x4EA8, 0x2D47,
0x2E7F, 0x83EB, 0x7339, 0x5BDE, 0x43DA, 0x3427, 0x542E, 0x0F61,
0x466A, 0x9358, 0x7C6B, 0x5A1B, 0x9718, 0x4A1D, 0x7926, 0x4CFB,
0x5ED3, 0x94A6, 0x3FA6, 0x5DFA, 0x1CFF, 0x3CB2, 0x3D06, 0x405A,
0x2F13, 0x3C9C, 0x1CC1, 0x5A8C, 0x5285, 0x729E, 0x32D3, 0x99F3,
0x0162, 0x0AEB, 0x3CD7, 0x589A, 0x9B59, 0x5268, 0x5D18, 0x81AD,
0x8D0A, 0x36B4, 0x82AA, 0x469E, 0x9A51, 0x6921, 0x41CA, 0x292C,
0x6272, 0x7C40, 0x8870, 0x6B70, 0x361D, 0x4868, 0x963C, 0x5066,
0x03D3, 0x5388, 0x2A9B, 0x78C5, 0x7CB2, 0x1ABC, 0x94CB, 0x2218,
0x31AA, 0x045F, 0x26B4, 0x6232, 0x458B, 0x4F7B, 0x1E7F, 0x003D,
0x846B, 0x9938, 0x0865, 0x0EC1, 0x0047, 0x799C, 0x62AB, 0x7B00,
0x0E20, 0x0D6C, 0x0143, 0x4A91, 0x03AB, 0x26A8, 0x243C, 0x571E,
0x8088, 0x50ED, 0x5178, 0x742E, 0x4416, 0x64ED, 0x09B2, 0x9F39,
0x2573, 0x2BD1, 0x6F91, 0x23C3, 0x87CA, 0x0D8B, 0x161F, 0x775E,
0x42BA, 0x8722, 0x8A3B, 0x7CBD, 0x2BB6, 0x6D36, 0x2A89, 0x0011,
0x01DF, 0x7927, 0x8ECA, 0x7E58, 0x0DA7, 0x988B, 0x1504, 0x2A2D,
0x4645, 0x4D2A, 0x03C8, 0x2060, 0x7D78, 0x2E51, 0x51B8, 0x6A2B,
0x298B, 0x795C, 0x1B16, 0x787C, 0x6D2B, 0x292B, 0x60AC, 0x844C,
0x0753, 0x30CA, 0x06CD, 0x01DC, 0x7521, 0x0351, 0x4608, 0x368F,
0x3946, 0x2A86, 0x5F40, 0x158B, 0x0A96, 0x85A9, 0x5788, 0x8A19,
0x4350, 0x17D0, 0x4C75, 0x39E6, 0x26F9, 0x0E60, 0x6CF7, 0x7DCD,
0x8314, 0x99FF, 0x85DD, 0x7161, 0x704F, 0x7104, 0x04E1, 0x514C,
0x2C08, 0x30B2, 0x5825, 0x8541, 0x9D1E, 0x0BCD, 0x3761, 0x6364,
0x0674, 0x4BFA, 0x3CF7, 0x5703, 0x4FC8, 0x364A, 0x4CE0, 0x43C2,
0x8EF5, 0x52D5, 0x71B1, 0x5AD7, 0x633C, 0x89B3, 0x99EB, 0x42D5,
0x02C5, 0x9540, 0x2D99, 0x5FDD, 0x3507, 0x36A4, 0x5057, 0x8DDF,
0x3E1E, 0x686E, 0x28C0, 0x7DFD, 0x955D, 0x2E73, 0x1062, 0x445D,
0x4ED0, 0x65D4, 0x4C08, 0x09EA, 0x8E8D, 0x7B19, 0x3EFA, 0x3B7C,
0x1585, 0x9CF7, 0x14A3, 0x3619, 0x5EB9, 0x1710, 0x0455, 0x444E,
0x65D9, 0x70DB, 0x812B, 0x2BAF, 0x49F1, 0x7367, 0x0861, 0x3C40,
0x2E7B, 0x98D0, 0x9D0D, 0x9D95, 0x8675, 0x2F8F, 0x6070, 0x49E7,
0x6B7B, 0x6369, 0x65AD, 0x0616, 0x46CD, 0x95E4, 0x3661, 0x52F8,
0x75C2, 0x1653, 0x9A58, 0x2D5A, 0x6024, 0x4864, 0x71FF, 0x522B,
0x6E31, 0x1F3E, 0x3618, 0x9B7A, 0x5702, 0x9FE0, 0x561B, 0x73B0,
0x586F, 0x166B, 0x227C, 0x5506, 0x1D71, 0x506C, 0x4D0D, 0x0686,
0x277A, 0x4620, 0x93EE, 0x7D93, 0x3B87, 0x051F, 0x88EA, 0x770A,
0x2086, 0x4457, 0x5B87, 0x1D26, 0x8462, 0x60D5, 0x7A18, 0x4D09,
0x9805, 0x169E, 0x3F43, 0x29CA, 0x0FBF, 0x74FB, 0x6A62, 0x1730,
0x96E5, 0x0309, 0x81B8, 0x50A9, 0x2E5A, 0x2575, 0x97E4, 0x6811,
0x252A, 0x87B8, 0x4DCE, 0x537E, 0x0479, 0x050B, 0x79C5, 0x895D,
0x849C, 0x8C41, 0x140C, 0x4766, 0x5FB2, 0x11CD, 0x6276, 0x776E,
0x728F, 0x4F5F, 0x12CC, 0x52BE, 0x274D, 0x7D7D, 0x58EE, 0x6387,
0x88AC, 0x67A1, 0x371E, 0x0FF3, 0x89C3, 0x074F, 0x67AC, 0x7D7B,
0x2631, 0x582C, 0x6D31, 0x886C, 0x6063, 0x4F1C, 0x76F6, 0x30E3,
0x113D, 0x4307, 0x181F, 0x0940, 0x8219, 0x6E64, 0x6332, 0x503C,
0x5A30, 0x070C, 0x866D, 0x57D8, 0x2DF6, 0x3228, 0x1DE7, 0x3742,
0x85F9, 0x0623, 0x14AD, 0x0E86, 0x8B24, 0x4328, 0x4FD8, 0x6260,
}

// private alice
s1_alice_test := [1024]RINGELT{
0x47C6, 0x521A, 0x14DF, 0x2FCC, 0x8DFE, 0x889B, 0x1C5D, 0x365D,
0x72EA, 0x8C83, 0x03FB, 0x9F1E, 0x6E15, 0x87FE, 0x1962, 0x383A,
0x7A93, 0x2809, 0x4286, 0x27F6, 0x04E6, 0x086A, 0x7342, 0x82D6,
0x95E5, 0x0EE5, 0x86BE, 0x4FDF, 0x17B2, 0x77F0, 0x3645, 0x94DF,
0x0F5E, 0x2E2F, 0x8AE4, 0x4FF3, 0x8FD7, 0x94A4, 0x763F, 0x17A9,
0x6C29, 0x5206, 0x9C1D, 0x9BC6, 0x299C, 0x8C8D, 0x20BA, 0x9D58,
0x1472, 0x6351, 0x1FFD, 0x63AE, 0x5175, 0x31CD, 0x621F, 0x3684,
0x60D3, 0x494B, 0x1377, 0x4775, 0x1201, 0x2CAB, 0x76EC, 0x3FC5,
0x9309, 0x2A91, 0x9BBE, 0x3E9A, 0x0DC0, 0x6052, 0x717A, 0x7C71,
0x188F, 0x8EA0, 0x9451, 0x0E85, 0x499F, 0x221F, 0x5DD8, 0x7D95,
0x8337, 0x26C6, 0x12F3, 0x1717, 0x5431, 0x9539, 0x5E67, 0x5D6D,
0x0D1E, 0x8F58, 0x4772, 0x898A, 0x80D0, 0x127C, 0x6B83, 0x8523,
0x75B4, 0x5D1B, 0x488E, 0x7BFC, 0x2867, 0x6279, 0x81D4, 0x4461,
0x4D99, 0x92CE, 0x144D, 0x357F, 0x733D, 0x0B3C, 0x209B, 0x6DF6,
0x77DD, 0x9E28, 0x347D, 0x2E21, 0x9556, 0x6EFD, 0x7A7C, 0x99E7,
0x0089, 0x25F7, 0x577F, 0x3602, 0x2C58, 0x75D7, 0x6148, 0x2C39,
0x1862, 0x47F0, 0x33D8, 0x628A, 0x7137, 0x6CB7, 0x415E, 0x0E04,
0x6D2A, 0x3128, 0x39A3, 0x8722, 0x329E, 0x1CFF, 0x003A, 0x03F3,
0x669E, 0x2CD6, 0x5AF0, 0x9BE9, 0x8BDD, 0x193E, 0x76F8, 0x8224,
0x9489, 0x2CFA, 0x4391, 0x5ABB, 0x4225, 0x8AE5, 0x496C, 0x2F1F,
0x7F67, 0x524F, 0x9F9D, 0x24CC, 0x13C6, 0x694C, 0x9D60, 0x7957,
0x9DD4, 0x61EB, 0x3F58, 0x5898, 0x02C0, 0x41B6, 0x56B3, 0x6346,
0x323B, 0x8F6D, 0x0902, 0x8DAB, 0x252A, 0x1466, 0x6FAF, 0x1232,
0x23CA, 0x7A6F, 0x2E94, 0x6D61, 0x83BD, 0x8C25, 0x59E7, 0x204C,
0x9A7B, 0x8742, 0x024E, 0x6741, 0x0869, 0x9335, 0x74AB, 0x09D1,
0x0964, 0x9570, 0x305E, 0x7471, 0x6EB9, 0x97E5, 0x96D4, 0x12D9,
0x5468, 0x4C41, 0x80B0, 0x8139, 0x6D00, 0x6037, 0x4BAF, 0x6319,
0x48F5, 0x9F54, 0x511C, 0x6888, 0x357E, 0x76F7, 0x7DF2, 0x2BB5,
0x2803, 0x3017, 0x9AE0, 0x5DA3, 0x0504, 0x39DF, 0x9433, 0x5FAF,
0x0316, 0x14B9, 0x48B6, 0x7C51, 0x03BD, 0x7D92, 0x1F0B, 0x8494,
0x8551, 0x19CD, 0x6279, 0x3EA5, 0x1BF3, 0x1605, 0x09FA, 0x04A8,
0x6292, 0x2B5C, 0x6EB8, 0x43A1, 0x0F76, 0x9D44, 0x0C2A, 0x7777,
0x79C9, 0x080E, 0x3F06, 0x07E8, 0x8BBB, 0x6DDE, 0x9101, 0x2B1D,
0x1E2C, 0x5CEC, 0x6123, 0x19AE, 0x8686, 0x0992, 0x3D01, 0x7765,
0x6951, 0x8C34, 0x13DA, 0x9BFC, 0x5881, 0x3B7C, 0x80AE, 0x41A7,
0x6A0F, 0x8D62, 0x4C32, 0x7CAB, 0x11CB, 0x1E4B, 0x7C62, 0x3A8C,
0x004A, 0x4BE3, 0x24A4, 0x9E36, 0x1549, 0x5689, 0x506D, 0x825A,
0x410C, 0x0861, 0x58D9, 0x92B1, 0x225F, 0x28CE, 0x9422, 0x257F,
0x39D1, 0x2DCE, 0x42FE, 0x52E2, 0x412C, 0x93B3, 0x10D6, 0x61EF,
0x3302, 0x4C8A, 0x660E, 0x9B23, 0x3DB1, 0x1686, 0x0659, 0x1D2B,
0x1E9B, 0x1348, 0x9E24, 0x2394, 0x7A2F, 0x888A, 0x1BA6, 0x7ED7,
0x1D91, 0x706C, 0x98FC, 0x7B6A, 0x491A, 0x5AB3, 0x9DCC, 0x00A7,
0x8B82, 0x2C95, 0x1780, 0x3AB3, 0x5E33, 0x7CC8, 0x1C52, 0x1CDE,
0x7DBE, 0x7AB0, 0x1E72, 0x8799, 0x2FB7, 0x6CB8, 0x4F08, 0x1593,
0x7CD2, 0x0C92, 0x48F3, 0x8605, 0x485D, 0x77E4, 0x1959, 0x778A,
0x186F, 0x5C0C, 0x803A, 0x8E78, 0x91A7, 0x8CBB, 0x106E, 0x965B,
0x7013, 0x0565, 0x8696, 0x5E16, 0x8F44, 0x9B4D, 0x9539, 0x8708,
0x67DA, 0x82B3, 0x7449, 0x2BBD, 0x441F, 0x56AC, 0x1BD8, 0x61FB,
0x8B7D, 0x1AB7, 0x0270, 0x1B7E, 0x6A4A, 0x670C, 0x3BF5, 0x1AFE,
0x6353, 0x1E9C, 0x4207, 0x060E, 0x024B, 0x869A, 0x09E8, 0x296C,
0x8E49, 0x8AFF, 0x6569, 0x2CF3, 0x9C8D, 0x4B21, 0x4CFC, 0x37C6,
0x4F79, 0x724D, 0x8135, 0x3D10, 0x494D, 0x8F5E, 0x17A0, 0x53B7,
0x1CA8, 0x59F6, 0x6D6E, 0x6148, 0x9479, 0x9328, 0x0792, 0x2214,
0x1DD3, 0x3A1C, 0x257E, 0x4BC7, 0x716F, 0x08A0, 0x701F, 0x6163,
0x493C, 0x0918, 0x883F, 0x8DD7, 0x4785, 0x14F4, 0x86AF, 0x77FE,
0x2774, 0x0E28, 0x6244, 0x1663, 0x7A49, 0x4E31, 0x3038, 0x0075,
0x9FB3, 0x3C90, 0x52F1, 0x6C85, 0x7E56, 0x8D8F, 0x4696, 0x2927,
0x4920, 0x4D70, 0x02FD, 0x6A84, 0x9BA5, 0x168C, 0x4D78, 0x7AAB,
0x54FD, 0x649D, 0x77BA, 0x44A2, 0x00F8, 0x5B05, 0x57E8, 0x1251,
0x47ED, 0x9AEB, 0x3B88, 0x633B, 0x72F0, 0x6E2C, 0x9C11, 0x4076,
0x1E4A, 0x892C, 0x5272, 0x3A01, 0x2D17, 0x98FD, 0x1B70, 0x30E8,
0x9E6E, 0x7596, 0x76D8, 0x6572, 0x322F, 0x7E8A, 0x5C47, 0x50B1,
0x02C0, 0x2AC4, 0x05BE, 0x2874, 0x55EC, 0x8A3F, 0x46A4, 0x992F,
0x5062, 0x15B2, 0x0026, 0x2C92, 0x3CC9, 0x63C3, 0x71AE, 0x11C8,
0x5F03, 0x4088, 0x30A6, 0x6D4B, 0x2F17, 0x94E3, 0x7AC1, 0x8CD9,
0x589A, 0x9667, 0x3F35, 0x9C2F, 0x0D64, 0x744D, 0x508A, 0x3DD7,
0x5C62, 0x39A2, 0x6559, 0x8186, 0x15C9, 0x4E6B, 0x003F, 0x105C,
0x8F22, 0x7FBE, 0x6CC6, 0x164D, 0x2720, 0x638E, 0x0A63, 0x79C9,
0x19ED, 0x1F44, 0x920F, 0x293E, 0x599A, 0x60DC, 0x9F32, 0x6A3D,
0x0C8B, 0x4633, 0x7D2B, 0x9ACE, 0x6F00, 0x4B25, 0x30D8, 0x1E67,
0x5688, 0x4186, 0x93B3, 0x88DB, 0x6875, 0x9613, 0x1276, 0x46DF,
0x4261, 0x55F0, 0x0FB8, 0x2D46, 0x64D8, 0x25A5, 0x1A8E, 0x0F68,
0x2F4D, 0x43C8, 0x88FE, 0x6DA7, 0x29D0, 0x258A, 0x4D6E, 0x243B,
0x63C8, 0x2703, 0x5B68, 0x557B, 0x70CF, 0x66B8, 0x8671, 0x98A3,
0x7134, 0x8A94, 0x0AE2, 0x4D82, 0x6FFF, 0x4E8C, 0x57B9, 0x525A,
0x49CA, 0x1AC6, 0x0259, 0x6AC4, 0x7382, 0x7578, 0x1233, 0x81D4,
0x6D26, 0x113E, 0x4001, 0x17A4, 0x330B, 0x227B, 0x3983, 0x7454,
0x0332, 0x316F, 0x3545, 0x3705, 0x9919, 0x05DE, 0x1793, 0x9383,
0x8138, 0x0B76, 0x1FBE, 0x2A6C, 0x83AB, 0x3895, 0x8BCC, 0x0066,
0x7722, 0x7E80, 0x211F, 0x01B1, 0x5A33, 0x2628, 0x68FC, 0x817B,
0x5A24, 0x7801, 0x1E50, 0x6829, 0x86E1, 0x268E, 0x9128, 0x22B9,
0x4E91, 0x5588, 0x2775, 0x0F21, 0x48E4, 0x0BB0, 0x8242, 0x1956,
0x9407, 0x1416, 0x4C1D, 0x8492, 0x117C, 0x4EB9, 0x065E, 0x7B66,
0x9968, 0x1025, 0x524C, 0x0DF5, 0x5FAC, 0x3598, 0x010A, 0x4372,
0x28F7, 0x91F0, 0x8505, 0x214C, 0x459E, 0x4548, 0x5CC3, 0x4B28,
0x94E8, 0x8FB4, 0x74B0, 0x7FAD, 0x9942, 0x62A6, 0x3DDE, 0x7FA0,
0x73F5, 0x1587, 0x6704, 0x806B, 0x6860, 0x0DBA, 0x62B6, 0x9695,
0x9FB0, 0x0D24, 0x916F, 0x38FD, 0x1150, 0x3F3C, 0x33B4, 0x33BA,
0x8005, 0x149A, 0x7D93, 0x7243, 0x161C, 0x9D8B, 0x704E, 0x81BC,
0x1562, 0x262B, 0x0ED0, 0x8B43, 0x1A18, 0x38A6, 0x4809, 0x828F,
0x8168, 0x6D32, 0x006E, 0x7EB5, 0x871B, 0x7FD4, 0x3FD4, 0x958C,
0x8583, 0x18F5, 0x4A3D, 0x17D0, 0x97BB, 0x042E, 0x09B7, 0x6B50,
0x567F, 0x91A5, 0x9062, 0x8D04, 0x467D, 0x82D0, 0x0AAD, 0x3562,
0x5414, 0x0A7A, 0x8597, 0x974A, 0x702A, 0x0257, 0x98CD, 0x8EB3,
0x34ED, 0x2017, 0x27EF, 0x6873, 0x0121, 0x9288, 0x7777, 0x2BF4,
0x18FA, 0x4DA5, 0x3D3E, 0x77EA, 0x2640, 0x3ED6, 0x4C4B, 0x73C5,
0x887B, 0x584A, 0x0A6C, 0x41FB, 0x0B42, 0x0421, 0x8F84, 0x16B5,
0x9764, 0x1FBE, 0x1897, 0x226F, 0x5B6D, 0x4D99, 0x1804, 0x170D,
0x0DA8, 0x7262, 0x8760, 0x1834, 0x3B58, 0x34DD, 0x91AC, 0x5014,
0x5ECC, 0x5445, 0x1914, 0x1C26, 0x4D7C, 0x5515, 0x672B, 0x493E,
0x233A, 0x415D, 0x504B, 0x8D79, 0x1E1A, 0x7F2E, 0x13AA, 0x5629,
0x10EA, 0x22CA, 0x3AC9, 0x6E47, 0x51D6, 0x0A6B, 0x1D96, 0x165D,
0x86C1, 0x3847, 0x68F9, 0x3E1B, 0x0282, 0x7BF9, 0x20CE, 0x5C68,
0x0A42, 0x9D9B, 0x6CF6, 0x85D9, 0x2F84, 0x1DBE, 0x436A, 0x0B9E,
0x0EFA, 0x7FCD, 0x891D, 0x8CA0, 0x15FD, 0x2695, 0x4288, 0x0C49,
0x4D2F, 0x6C59, 0x8A8C, 0x2AEB, 0x2032, 0x7754, 0x6CEA, 0x2EAC,
0x44CF, 0x77F3, 0x6ECE, 0x0E3F, 0x6FC9, 0x8847, 0x8DF3, 0x66BD,
0x10B3, 0x4A5A, 0x3FD0, 0x4A64, 0x70AA, 0x2A31, 0x1E8C, 0x2130,
0x2DD3, 0x89F8, 0x00BD, 0x6725, 0x6946, 0x2E17, 0x1D33, 0x9032,
0x755B, 0x572D, 0x202C, 0x5982, 0x2B33, 0x20FB, 0x8252, 0x3830,
0x64DA, 0x9B55, 0x4A3E, 0x4B34, 0x3707, 0x792D, 0x4E2F, 0x86D3,
0x1CDA, 0x4625, 0x31D3, 0x7EDA, 0x1E00, 0x1D2C, 0x1564, 0x88D7,
0x27AB, 0x5306, 0x4D5F, 0x27E7, 0x8450, 0x00AC, 0x0ADC, 0x4EE4,
0x133D, 0x52E9, 0x5D93, 0x53C4, 0x89BB, 0x55F8, 0x2B68, 0x896D,
0x1BC0, 0x2BF1, 0x97B1, 0x2FF3, 0x4407, 0x7464, 0x64AC, 0x9E97,
0x7DFE, 0x612F, 0x9544, 0x5F4B, 0x3A6D, 0x1781, 0x4BF0, 0x1813,
0x1735, 0x3BBC, 0x2F66, 0x64DE, 0x7B6B, 0x98A3, 0x8463, 0x0945,
0x7109, 0x45BE, 0x6AB8, 0x6526, 0x09A8, 0x3DC0, 0x62C7, 0x9ECF,
0x0FBF, 0x68A8, 0x1F3D, 0x8D50, 0x487C, 0x376B, 0x3776, 0x81F6,
0x6045, 0x2CFB, 0x8FD7, 0x6E17, 0x50ED, 0x56EE, 0x1816, 0x152E,
0x6CF4, 0x67E4, 0x3C4E, 0x8507, 0x02A0, 0x3A2A, 0x1F68, 0x7AED,
0x3CA7, 0x207F, 0x9DAF, 0x9E23, 0x7E31, 0x26C4, 0x9973, 0x6C5B,
0x2E75, 0x51A6, 0x1A81, 0x7E8D, 0x3E4C, 0x0D1E, 0x8061, 0x997A,
0x6BFB, 0x4644, 0x553D, 0x93CC, 0x0F46, 0x5EED, 0x6C88, 0x1B4D,
0x6FA3, 0x0625, 0x628E, 0x21AF, 0x3307, 0x8D96, 0x50A7, 0x2FF6,
0x4984, 0x8898, 0x85CF, 0x622B, 0x4DC6, 0x0EDF, 0x3554, 0x368E,
0x558A, 0x7FDD, 0x30EE, 0x4FD1, 0x052E, 0x704B, 0x5086, 0x9100,
0x0FA5, 0x7C8C, 0x46C6, 0x929C, 0x74D1, 0x4479, 0x747F, 0x5B28,
}

// public bob
b_bob_test := [1024]RINGELT{
0x107E, 0x6BF7, 0x5149, 0x5AB8, 0x45CB, 0x16DD, 0x102C, 0x8F14,
0x893C, 0x4EA1, 0x5864, 0x9ABE, 0x82C1, 0x8C34, 0x7EB2, 0x31F4,
0x737B, 0x0286, 0x9663, 0x3E2B, 0x0370, 0x64A7, 0x5A02, 0x8D70,
0x55B9, 0x9A07, 0x66B4, 0x7982, 0x40F2, 0x07C2, 0x0E86, 0x9249,
0x3CFF, 0x8318, 0x34F2, 0x7F01, 0x58D5, 0x61FE, 0x9114, 0x1EF0,
0x555B, 0x4A27, 0x4BB6, 0x3E2A, 0x7274, 0x13BA, 0x9076, 0x339D,
0x9F72, 0x22B8, 0x606A, 0x0A9D, 0x4067, 0x3C5D, 0x647F, 0x8C15,
0x37C0, 0x7E02, 0x76FA, 0x9DD7, 0x5DFF, 0x01AD, 0x68B9, 0x92EA,
0x7093, 0x4AC4, 0x7725, 0x1109, 0x7221, 0x64DF, 0x7C69, 0x1281,
0x7ADF, 0x8313, 0x18C1, 0x2E10, 0x0400, 0x0BB0, 0x6368, 0x1820,
0x1816, 0x1F45, 0x0F51, 0x91F4, 0x2F7E, 0x5F6B, 0x935F, 0x8845,
0x237D, 0x348B, 0x99DF, 0x2110, 0x2D4A, 0x1EC5, 0x4981, 0x8C63,
0x378E, 0x3FC3, 0x03B6, 0x657F, 0x4A29, 0x332A, 0x5A69, 0x32FE,
0x2FC7, 0x7D1B, 0x8BD1, 0x64F5, 0x3803, 0x99B9, 0x1A9A, 0x598B,
0x8356, 0x4639, 0x7C04, 0x3F6B, 0x7680, 0x9EEA, 0x43ED, 0x0207,
0x7218, 0x2988, 0x8F0C, 0x7255, 0x601A, 0x3258, 0x5E1D, 0x08FA,
0x64BD, 0x8DDA, 0x33A0, 0x49CC, 0x0E77, 0x66DC, 0x399B, 0x2FF1,
0x9C92, 0x749F, 0x25B3, 0x2438, 0x952A, 0x4ACC, 0x046D, 0x2ECB,
0x11DB, 0x3DAE, 0x8A9A, 0x0D3F, 0x3AD6, 0x51CA, 0x9D6C, 0x5D41,
0x0BD1, 0x4829, 0x4D96, 0x39DC, 0x64CF, 0x1A01, 0x2E98, 0x38A1,
0x88C4, 0x0827, 0x4A28, 0x869D, 0x22A2, 0x3FAA, 0x11D0, 0x0557,
0x5089, 0x9FF1, 0x7A2C, 0x33E4, 0x64AC, 0x175C, 0x79F6, 0x18C2,
0x9F77, 0x602E, 0x29BD, 0x2A78, 0x359F, 0x64A0, 0x95FF, 0x9B5A,
0x89F1, 0x2148, 0x19D8, 0x3F90, 0x8FB3, 0x579B, 0x42A4, 0x156B,
0x18A3, 0x4A25, 0x2CDD, 0x5D32, 0x8AC2, 0x53FB, 0x23F4, 0x904F,
0x6681, 0x5D3B, 0x8518, 0x049E, 0x0334, 0x1C9E, 0x5D0D, 0x92CF,
0x5865, 0x9DA5, 0x31B4, 0x61F8, 0x7DD5, 0x94E1, 0x7094, 0x89B7,
0x8718, 0x1EF6, 0x061C, 0x10E7, 0x011C, 0x3CEB, 0x95F7, 0x379C,
0x01CF, 0x28D6, 0x133A, 0x3BE2, 0x2E32, 0x7864, 0x00CB, 0x778A,
0x08BC, 0x16AC, 0x3362, 0x3223, 0x96E9, 0x7C05, 0x7618, 0x2678,
0x0A4E, 0x6A41, 0x94E0, 0x8791, 0x4755, 0x6770, 0x84C8, 0x30FA,
0x70DF, 0x21AB, 0x9860, 0x2672, 0x2D25, 0x4FFA, 0x07FB, 0x9303,
0x5DBB, 0x2E3B, 0x806F, 0x12FB, 0x84C5, 0x6B4C, 0x658C, 0x447C,
0x42A6, 0x22A6, 0x8438, 0x4215, 0x2D58, 0x3B16, 0x755A, 0x8FB7,
0x9BE3, 0x3220, 0x2130, 0x1F1A, 0x428D, 0x00BF, 0x0C21, 0x1B1F,
0x0766, 0x4DCA, 0x736C, 0x9853, 0x9533, 0x1887, 0x2C96, 0x2F84,
0x14D9, 0x8517, 0x6C39, 0x0B91, 0x92DA, 0x72E0, 0x1A5B, 0x0638,
0x5978, 0x2B45, 0x9034, 0x5C3D, 0x4FCD, 0x5BDE, 0x1B2B, 0x213D,
0x7C7E, 0x8E09, 0x6CCD, 0x4966, 0x7405, 0x26FF, 0x9D39, 0x4B72,
0x15EB, 0x4BA8, 0x5A50, 0x7313, 0x03BF, 0x0A98, 0x25CB, 0x68B6,
0x9742, 0x97FE, 0x965A, 0x1364, 0x02D7, 0x9A5B, 0x6DE7, 0x886D,
0x9F6D, 0x07F1, 0x8961, 0x6082, 0x3314, 0x8431, 0x21B1, 0x6EC7,
0x6A14, 0x5CC9, 0x8B7B, 0x9EA1, 0x0BE4, 0x1446, 0x5C05, 0x8112,
0x9587, 0x8C8D, 0x967B, 0x8BA1, 0x25E2, 0x9500, 0x028C, 0x71FB,
0x85B9, 0x8160, 0x6A60, 0x06A9, 0x5D15, 0x641C, 0x97E0, 0x5AEF,
0x0EEB, 0x9483, 0x3F11, 0x46B9, 0x2944, 0x4A51, 0x22E8, 0x1D30,
0x25D7, 0x4AE1, 0x11C3, 0x0411, 0x2ED2, 0x6868, 0x0C29, 0x8C93,
0x9F6C, 0x696D, 0x3FA0, 0x79FE, 0x7631, 0x6A15, 0x48DB, 0x506F,
0x50C3, 0x28B2, 0x6C20, 0x1F54, 0x070A, 0x2081, 0x69C4, 0x3025,
0x8A5E, 0x397F, 0x0428, 0x34A1, 0x61A6, 0x64C1, 0x54B9, 0x9C42,
0x5169, 0x64FF, 0x82F5, 0x7A0D, 0x0076, 0x0C5C, 0x6C1E, 0x14E7,
0x323C, 0x6AC3, 0x0DBF, 0x3C7A, 0x05FE, 0x9B11, 0x2447, 0x7F6D,
0x1FF8, 0x2642, 0x17BF, 0x28A1, 0x41A6, 0x5EE6, 0x2764, 0x4802,
0x9F39, 0x0E08, 0x394E, 0x2CD9, 0x9F4C, 0x0F6C, 0x0064, 0x680F,
0x53FB, 0x163B, 0x6ED3, 0x3B86, 0x4CB5, 0x913A, 0x0301, 0x6F57,
0x3F49, 0x073A, 0x795B, 0x01B2, 0x20AC, 0x02ED, 0x1E03, 0x8AE2,
0x2A6A, 0x12F8, 0x46EB, 0x4E7E, 0x0495, 0x3259, 0x2334, 0x6A3F,
0x8A94, 0x2CCA, 0x2A2F, 0x3049, 0x4D46, 0x1C6B, 0x3CE4, 0x2CD5,
0x2264, 0x43D9, 0x8B1E, 0x5438, 0x46CD, 0x0512, 0x8D5B, 0x4405,
0x75C1, 0x5DCB, 0x69C4, 0x7E13, 0x365E, 0x2722, 0x5F21, 0x8440,
0x3E97, 0x69D9, 0x5F6B, 0x1AD6, 0x52D0, 0x169B, 0x4733, 0x887B,
0x357B, 0x62D6, 0x299C, 0x2B92, 0x0739, 0x5837, 0x5041, 0x1B0F,
0x8978, 0x653D, 0x3CD5, 0x8849, 0x26EA, 0x0D7B, 0x2979, 0x1CD8,
0x9AB2, 0x3750, 0x91CB, 0x73EA, 0x2D85, 0x8864, 0x93C2, 0x3C30,
0x0FAB, 0x710C, 0x4E76, 0x8BAE, 0x9475, 0x043F, 0x0A76, 0x54D7,
0x1430, 0x3AAE, 0x412F, 0x1FE2, 0x4490, 0x79D5, 0x6338, 0x25F4,
0x88BD, 0x2914, 0x311F, 0x2F01, 0x93EA, 0x5E79, 0x0557, 0x7C50,
0x33B0, 0x3FF6, 0x63F7, 0x2519, 0x403D, 0x53DA, 0x8241, 0x0B47,
0x86E5, 0x5E98, 0x51AC, 0x6746, 0x03BD, 0x795C, 0x6EAB, 0x7B71,
0x367E, 0x8B92, 0x4436, 0x0943, 0x9C12, 0x74CD, 0x3EF5, 0x2586,
0x8AC1, 0x39C3, 0x3631, 0x5BAD, 0x9FA3, 0x1EB8, 0x839D, 0x0869,
0x33F2, 0x9E21, 0x10A0, 0x0A7C, 0x81DA, 0x7B1E, 0x0258, 0x97E1,
0x9553, 0x7C02, 0x4D1D, 0x444C, 0x7CD1, 0x0BB8, 0x4FFD, 0x9860,
0x8E57, 0x2A50, 0x5119, 0x7D36, 0x5C34, 0x260C, 0x3C53, 0x48C1,
0x728A, 0x196C, 0x6EAA, 0x3FEA, 0x2745, 0x0F1D, 0x479C, 0x6E75,
0x9A8A, 0x4DD8, 0x04A4, 0x8E8C, 0x36D8, 0x813E, 0x6724, 0x3FDA,
0x56FB, 0x16A1, 0x75CE, 0x64BA, 0x41B7, 0x487A, 0x6156, 0x1D55,
0x64B4, 0x6440, 0x945C, 0x812C, 0x618B, 0x78FC, 0x6B81, 0x01B9,
0x6C6F, 0x3FCC, 0x62E2, 0x1A7D, 0x4794, 0x72E3, 0x49DA, 0x7FA8,
0x7B52, 0x796F, 0x6AFD, 0x04F5, 0x333F, 0x941D, 0x1385, 0x7206,
0x4483, 0x32C1, 0x794D, 0x715C, 0x2683, 0x6F3D, 0x5CE5, 0x472B,
0x36EF, 0x2FF6, 0x1684, 0x0707, 0x9176, 0x2729, 0x2EDD, 0x4DD1,
0x4365, 0x36ED, 0x757B, 0x7E7D, 0x920A, 0x3FBD, 0x5B50, 0x3F68,
0x1C2A, 0x5A96, 0x4865, 0x3F00, 0x3D37, 0x646C, 0x3DB8, 0x9973,
0x34C6, 0x4ADB, 0x0D24, 0x48FA, 0x4F45, 0x47E4, 0x4B85, 0x6B3F,
0x58D6, 0x7FB1, 0x0742, 0x8EBA, 0x027B, 0x62B1, 0x1316, 0x161F,
0x19D6, 0x9C21, 0x0376, 0x31F7, 0x1DAC, 0x49B0, 0x3B80, 0x18D3,
0x2DE9, 0x7156, 0x7D7B, 0x91F2, 0x0A5A, 0x5847, 0x19FD, 0x7D17,
0x2645, 0x7E63, 0x6C9B, 0x008B, 0x2E57, 0x27DE, 0x0EB5, 0x163C,
0x04B1, 0x2D57, 0x6AB7, 0x5E44, 0x14B7, 0x1FF2, 0x109B, 0x213E,
0x8BC9, 0x4F3B, 0x1CF0, 0x5DCA, 0x9B3D, 0x2C8C, 0x3559, 0x7DB9,
0x72AA, 0x070E, 0x447E, 0x37E7, 0x245D, 0x0E9F, 0x90B3, 0x55C5,
0x267C, 0x470A, 0x4E16, 0x30BD, 0x5B3F, 0x41FF, 0x607E, 0x0681,
0x73FA, 0x81D8, 0x323E, 0x7A3C, 0x2C03, 0x002F, 0x5707, 0x18F7,
0x3877, 0x0790, 0x2366, 0x1EB4, 0x48F9, 0x86E0, 0x1A61, 0x813D,
0x3CA7, 0x763A, 0x582E, 0x6045, 0x87D6, 0x7BAB, 0x031E, 0x26C4,
0x73AD, 0x33C4, 0x1600, 0x8D70, 0x147C, 0x3716, 0x64CC, 0x19E2,
0x07F4, 0x221B, 0x0604, 0x5343, 0x66F3, 0x2C08, 0x37ED, 0x1145,
0x21BC, 0x8BDD, 0x5E34, 0x6069, 0x83D0, 0x7842, 0x8EEA, 0x238C,
0x8D9E, 0x4DA3, 0x602C, 0x6E3E, 0x5012, 0x6425, 0x28D9, 0x22C1,
0x5E3B, 0x57DC, 0x8BBF, 0x4A3F, 0x579D, 0x643E, 0x7611, 0x6BF3,
0x2599, 0x7AE9, 0x73BC, 0x0F24, 0x3917, 0x1114, 0x341A, 0x71BC,
0x2F43, 0x6270, 0x4C21, 0x8FEC, 0x65A5, 0x8E5C, 0x2ACA, 0x7822,
0x476F, 0x260E, 0x8619, 0x560B, 0x9FFE, 0x83F6, 0x8071, 0x742C,
0x7B70, 0x6AE5, 0x51D7, 0x3FC1, 0x3F81, 0x39BD, 0x7CD2, 0x105D,
0x953B, 0x94BF, 0x925E, 0x4AB3, 0x992B, 0x6D4C, 0x69DF, 0x8B25,
0x4CBE, 0x36EA, 0x7777, 0x2091, 0x412A, 0x610C, 0x7360, 0x6EFF,
0x5524, 0x6847, 0x616C, 0x390E, 0x72C4, 0x7704, 0x8872, 0x96CA,
0x5BF1, 0x3767, 0x71C2, 0x122A, 0x6413, 0x57A1, 0x078A, 0x0C26,
0x1369, 0x9683, 0x1020, 0x6A87, 0x0341, 0x79EC, 0x515D, 0x1670,
0x8AE7, 0x1410, 0x6FBD, 0x5C59, 0x14F4, 0x04C4, 0x6DE4, 0x039F,
0x8FDA, 0x76A1, 0x171E, 0x705C, 0x0A1B, 0x5E6E, 0x226A, 0x4BD4,
0x0B62, 0x6D1C, 0x0584, 0x702D, 0x0AEF, 0x9748, 0x66F6, 0x0F68,
0x110D, 0x75B5, 0x9447, 0x144B, 0x6FD2, 0x75A8, 0x143B, 0x15A9,
0x61D5, 0x9974, 0x9C29, 0x1BBF, 0x918A, 0x26C4, 0x853C, 0x98BB,
0x9E4E, 0x8A91, 0x4D53, 0x2006, 0x2580, 0x8E87, 0x2583, 0x0763,
0x52C1, 0x94A2, 0x1F59, 0x9B86, 0x1FD8, 0x2A30, 0x4D50, 0x8DD7,
0x400E, 0x9A74, 0x273E, 0x1680, 0x1512, 0x21B5, 0x1342, 0x75F2,
0x7DD3, 0x6F09, 0x461F, 0x225E, 0x67B6, 0x260A, 0x167A, 0x4DE8,
0x95AA, 0x1793, 0x3586, 0x0FA4, 0x7CB7, 0x8256, 0x62E6, 0x2CEE,
0x70ED, 0x7FD8, 0x6A49, 0x36E7, 0x0278, 0x29AE, 0x09BE, 0x4129,
0x833B, 0x365D, 0x54AE, 0x108F, 0x7E26, 0x75AD, 0x7338, 0x1E8C,
0x1A26, 0x3E0A, 0x5D02, 0x2E39, 0x1B0D, 0x0C32, 0x8168, 0x1812,
0x062F, 0x121E, 0x5B64, 0x6ABD, 0x9514, 0x4120, 0x404C, 0x1635,
0x486C, 0x81C2, 0x269F, 0x1C15, 0x31DC, 0x26F1, 0x9F84, 0x9B92,
0x200A, 0x1B16, 0x7311, 0x7EE2, 0x2970, 0x423C, 0x71CB, 0x71F5,
0x600F, 0x24E2, 0x75A0, 0x0FD2, 0x5DB1, 0x6A14, 0x66FE, 0x4234,
0x03DE, 0x8AF0, 0x2861, 0x708D, 0x368D, 0x27E1, 0x52A7, 0x331A,
}
cr_v_test := [16]uint64{
0x04FF71D7CB9A8EBC, 0x18A5348F59B05EFA, 0x9D465A78074EE014, 0x71D9592627FC9ACF,
0x8966E32399672956, 0x151179C8C3106F2E, 0x55B7208A2AD5517C, 0x60F663275D69A426,
0x1643E93A59A62D1D, 0x8C2775AC7F7D8A35, 0xCAAF7DC802928846, 0x01E4049C1355156F,
0x3A69C65D34A3FB6F, 0x8ED34C04394544AC, 0xFE5FF1D49FFB339E, 0x31EABCF3CDC69BF1,
}
mu_test := [16]uint64{
0x1D227EBB6944FA5C, 0x1DFD06D509150CD7, 0x74CA08D9A966AD74, 0xA3488937173DE33F,
0x02F39D787D8A7280, 0xD89827075344594E, 0x8B66D209A9FF9416, 0xDD80A8447FC808CB,
0x8A4623EA1175DD78, 0x6E7F67151C54BD2E, 0xFEF9F0B188DC3FE6, 0x215AF5BDA3339882,
0x3F704DB589620678, 0x75D6803812F542DE, 0xF1E43FB042ADCE30, 0xDAEB0C961C811BD1,
}

var mu_alice [muwords]uint64 /* Alice's recovered mu */

_ = s0_alice_test
_ = b_alice_test
private_alice := s1_alice_test[:]
u_copy := b_bob_test[:]
KEM1_Decapsulate(&mu_alice, u_copy, private_alice, cr_v_test)

for i := 0; i < 16; i++ {
if mu_alice[i] != mu_test[i] {
t.Fatalf("RLWE test vector failed. Please do extensive tests")
}
}

}

/* this function tests the rwle implementation using test vector
this function only test n = 1024 q= 40961 vectors*/
func Benchmark_rlwe_kex(b *testing.B) {

for i := 0; i < b.N; i++ {

/*Exclusively For Alice*/
var s_alice [2 * m]RINGELT /* Alice's Private Key */
var mu_alice [muwords]uint64 /* Alice's recovered mu */

/*Exclusively For Bob*/
var mu_bob [muwords]uint64 /* Bob's version of mu */

/*Information that gets shared by Alice and Bob*/
var b_alice [m]RINGELT /* Alice's Public Key */
var u [m]RINGELT /* Bob's Ring Element from Encapsulation */
var cr_v [muwords]uint64 /* Cross Rounding of v */

// generate noise, private_key, public key for alice , public key is shared with bob
KEM1_Generate(&s_alice, &b_alice)

// the parameters are exchanged with bob
// bob generates his own shared key
public_alice := b_alice[:1024]
KEM1_Encapsulate(&u, &cr_v, &mu_bob, public_alice)

// the u and cr-v factors are used by alice to generate a
private_alice := s_alice[1024:]
u_copy := u[:]
KEM1_Decapsulate(&mu_alice, u_copy, private_alice, cr_v)

// test whether the kex was successful or not

for j := 0; j < 16; j++ {
if mu_bob[j] != mu_alice[j] {
b.Fatalf("Key exchange failed\n")
}
}

}

}

Loading…
Cancel
Save