os

An operating system
git clone https://erai.gay/code/os/
Log | Files | Refs | README | LICENSE

poly1305_test.om (1265B)


      1 func main(c: int, v: **byte, e: **byte) {
      2 	var _key: _poly1305_ctx;
      3 	var _text: _poly1305_ctx;
      4 	var _mac: _poly1305_ctx;
      5 	var key: *byte;
      6 	var text: *byte;
      7 	var mac: *byte;
      8 	var out: *file;
      9 
     10 	key = (&_key) as *byte;
     11 	text = (&_text) as *byte;
     12 	mac = (&_mac) as *byte;
     13 
     14 	out = nil;
     15 
     16 	bzero(key, 32);
     17 	bzero(text, 64);
     18 	bzero(mac, 32);
     19 
     20 	poly1305(mac, key, text, 64);
     21 	fxxd(out, mac, 16);
     22 
     23 	key[0] = 0x85 as byte;
     24 	key[1] = 0xd6 as byte;
     25 	key[2] = 0xbe as byte;
     26 	key[3] = 0x78 as byte;
     27 	key[4] = 0x57 as byte;
     28 	key[5] = 0x55 as byte;
     29 	key[6] = 0x6d as byte;
     30 	key[7] = 0x33 as byte;
     31 	key[8] = 0x7f as byte;
     32 	key[9] = 0x44 as byte;
     33 	key[10] = 0x52 as byte;
     34 	key[11] = 0xfe as byte;
     35 	key[12] = 0x42 as byte;
     36 	key[13] = 0xd5 as byte;
     37 	key[14] = 0x06 as byte;
     38 	key[15] = 0xa8 as byte;
     39 	key[16] = 0x01 as byte;
     40 	key[17] = 0x03 as byte;
     41 	key[18] = 0x80 as byte;
     42 	key[19] = 0x8a as byte;
     43 	key[20] = 0xfb as byte;
     44 	key[21] = 0x0d as byte;
     45 	key[22] = 0xb2 as byte;
     46 	key[23] = 0xfd as byte;
     47 	key[24] = 0x4a as byte;
     48 	key[25] = 0xbf as byte;
     49 	key[26] = 0xf6 as byte;
     50 	key[27] = 0xaf as byte;
     51 	key[28] = 0x41 as byte;
     52 	key[29] = 0x49 as byte;
     53 	key[30] = 0xf5 as byte;
     54 	key[31] = 0x1b as byte;
     55 
     56 	poly1305(mac, key, "Cryptographic Forum Research Group", 34);
     57 	fxxd(out, mac, 16);
     58 }