os

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

x25519_test.om (1266B)


      1 func main(argc: int, argv: **byte, envp: **byte) {
      2 	var _a: _ed25519_point;
      3 	var a: *byte;
      4 	var _b: _ed25519_point;
      5 	var b: *byte;
      6 	var _c: _ed25519_point;
      7 	var c: *byte;
      8 	var out: *file;
      9 
     10 	a = (&_a) as *byte;
     11 	b = (&_b) as *byte;
     12 	c = (&_c) as *byte;
     13 
     14 	out = nil;
     15 
     16 	assert(unhex(a, "e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c") == 32, "unhex");
     17 	assert(unhex(b, "a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4") == 32, "unhex");
     18 	assert(x25519(c, a, b), "decode");
     19 	fxxd(out, c, 32);
     20 	fputc(out, '\n');
     21 
     22 	x25519_base(a);
     23 	assert(unhex(b, "77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a") == 32, "unhex");
     24 	assert(x25519(c, a, b), "decode");
     25 	fxxd(out, c, 32);
     26 	fputc(out, '\n');
     27 
     28 	x25519_base(a);
     29 	assert(unhex(b, "5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb") == 32, "unhex");
     30 	assert(x25519(c, a, b), "decode");
     31 	fxxd(out, c, 32);
     32 	fputc(out, '\n');
     33 
     34 	x25519_base(a);
     35 	assert(unhex(b, "5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb") == 32, "unhex");
     36 	assert(x25519(c, a, b), "decode");
     37 	assert(unhex(b, "77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a") == 32, "unhex");
     38 	assert(x25519(c, c, b), "decode");
     39 	fxxd(out, c, 32);
     40 	fputc(out, '\n');
     41 }