T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.quebec/private_html/node_modules/sha.js/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/private_html/node_modules/sha.js/test/vectors.js
'use strict';

var tape = require('tape');
var vectors = require('hash-test-vectors');
// var from = require('bops/typedarray/from')
var Buffer = require('safe-buffer').Buffer;

var createHash = require('../');

function makeTest(alg, i, verbose) {
	var v = vectors[i];

	tape(alg + ': NIST vector ' + i, function (t) {
		if (verbose) {
			t.comment(v);
			t.comment('VECTOR', i);
			t.comment('INPUT', v.input);
			t.comment(Buffer.from(v.input, 'base64').toString('hex'));
		}

		var buf = Buffer.from(v.input, 'base64');
		t.equal(createHash(alg).update(buf).digest('hex'), v[alg]);

		// eslint-disable-next-line no-param-reassign
		i = ~~(buf.length / 2);
		var buf1 = buf.slice(0, i);
		var buf2 = buf.slice(i, buf.length);

		t.comment(buf1.length + ', ' + buf2.length + ', ' + buf.length);
		t.comment(createHash(alg)._block.length);

		t.equal(
			createHash(alg)
				.update(buf1)
				.update(buf2)
				.digest('hex'),
			v[alg]
		);

		var j, buf3;

		// eslint-disable-next-line no-param-reassign
		i = ~~(buf.length / 3);
		j = ~~(buf.length * 2 / 3);
		buf1 = buf.slice(0, i);
		buf2 = buf.slice(i, j);
		buf3 = buf.slice(j, buf.length);

		t.equal(
			createHash(alg)
				.update(buf1)
				.update(buf2)
				.update(buf3)
				.digest('hex'),
			v[alg]
		);

		setTimeout(function () {
			// avoid "too much recursion" errors in tape in firefox
			t.end();
		});
	});
}

vectors.forEach(function (v, i) {
	makeTest('sha', i);
	makeTest('sha1', i);
	makeTest('sha224', i);
	makeTest('sha256', i);
	makeTest('sha384', i);
	makeTest('sha512', i);
});

CasperSecurity Mini