Server IP : 108.163.255.210 / Your IP : 18.191.189.119 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/public_html/indijourneys.com/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)