Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/sha.js/test/ |
Upload File : |
var tape = require('tape') var Hash = require('../hash') var hex = '0A1B2C3D4E5F6G7H' function equal (t, a, b) { t.equal(a.length, b.length) t.equal(a.toString('hex'), b.toString('hex')) } var hexBuf = Buffer.from('0A1B2C3D4E5F6G7H', 'utf8') var count16 = { strings: ['0A1B2C3D4E5F6G7H'], buffers: [ hexBuf, Buffer.from('80000000000000000000000000000080', 'hex') ] } var empty = { strings: [''], buffers: [ Buffer.from('80000000000000000000000000000000', 'hex') ] } var multi = { strings: ['abcd', 'efhijk', 'lmnopq'], buffers: [ Buffer.from('abcdefhijklmnopq', 'ascii'), Buffer.from('80000000000000000000000000000080', 'hex') ] } var long = { strings: [hex + hex], buffers: [ hexBuf, hexBuf, Buffer.from('80000000000000000000000000000100', 'hex') ] } function makeTest (name, data) { tape(name, function (t) { var h = new Hash(16, 8) var hash = Buffer.alloc(20) var n = 2 var expected = data.buffers.slice() // t.plan(expected.length + 1) h._update = function (block) { var e = expected.shift() equal(t, block, e) if (n < 0) { throw new Error('expecting only 2 calls to _update') } } h._hash = function () { return hash } data.strings.forEach(function (string) { h.update(string, 'ascii') }) equal(t, h.digest(), hash) t.end() }) } makeTest('Hash#update 1 in 1', count16) makeTest('empty Hash#update', empty) makeTest('Hash#update 1 in 3', multi) makeTest('Hash#update 2 in 1', long)