MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / crypto_hash

Function crypto_hash

vmm/src/x25519.js:1172–1202  ·  view source on GitHub ↗
(out, m, n)

Source from the content-addressed store, hash-verified

1170 return n;
1171 }
1172 function crypto_hash(out, m, n) {
1173 var hh = new Int32Array(8), hl = new Int32Array(8), x = new Uint8Array(256), i, b = n;
1174 hh[0] = 0x6a09e667;
1175 hh[1] = 0xbb67ae85;
1176 hh[2] = 0x3c6ef372;
1177 hh[3] = 0xa54ff53a;
1178 hh[4] = 0x510e527f;
1179 hh[5] = 0x9b05688c;
1180 hh[6] = 0x1f83d9ab;
1181 hh[7] = 0x5be0cd19;
1182 hl[0] = 0xf3bcc908;
1183 hl[1] = 0x84caa73b;
1184 hl[2] = 0xfe94f82b;
1185 hl[3] = 0x5f1d36f1;
1186 hl[4] = 0xade682d1;
1187 hl[5] = 0x2b3e6c1f;
1188 hl[6] = 0xfb41bd6b;
1189 hl[7] = 0x137e2179;
1190 crypto_hashblocks_hl(hh, hl, m, n);
1191 n %= 128;
1192 for (i = 0; i < n; i++)
1193 x[i] = m[b - n + i];
1194 x[n] = 128;
1195 n = 256 - 128 * (n < 112 ? 1 : 0);
1196 x[n - 9] = 0;
1197 ts64(x, n - 8, (b / 0x20000000) | 0, b << 3);
1198 crypto_hashblocks_hl(hh, hl, x, n);
1199 for (i = 0; i < 8; i++)
1200 ts64(out, 8 * i, hh[i], hl[i]);
1201 return 0;
1202 }
1203 function add(p, q) {
1204 var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(), g = gf(), h = gf(), t = gf();
1205 Z(a, p[1], p[0]);

Callers 3

crypto_sign_directFunction · 0.70
crypto_sign_direct_rndFunction · 0.70
crypto_sign_openFunction · 0.70

Calls 2

crypto_hashblocks_hlFunction · 0.70
ts64Function · 0.70

Tested by

no test coverage detected