Lines Matching defs:m

504      * @param string $m string of length less than 2^67 bits.
508 private function uhash($m, $taglen)
536 $a = self::L1Hash($L1Key_i, $m);
537 $b = strlen($m) <= 1024 ? "\0\0\0\0\0\0\0\0$a" : self::L2Hash($L2Key_i, $a);
553 * @param string $m string of length less than 2^67 bits.
556 private static function L1Hash($k, $m)
561 $m = str_split($m, 1024);
569 for ($i = 0; $i < count($m) - 1; $i++) {
570 $m[$i] = pack('N*', ...unpack('V*', $m[$i])); // ENDIAN-SWAP
571 $y .= static::nh($k, $m[$i], $length);
578 $length = count($m) ? strlen($m[$i]) : 0;
581 $m[$i] = str_pad(isset($m[$i]) ? $m[$i] : '', $pad, "\0"); // zeropad
582 $m[$i] = pack('N*', ...unpack('V*', $m[$i])); // ENDIAN-SWAP
584 $y .= static::nh($k, $m[$i], new BigInteger($length * 8));
593 * @param string $m string with length divisible by 32 bytes.
596 private static function nh($k, $m, $length)
607 //$t = strlen($m) >> 2;
608 $m = str_split($m, 4);
609 $t = count($m);
613 $m = array_map($toUInt32, $m);
624 $temp = $m[$i]->add($k[$i]);
626 $temp = $temp->multiply($m[$i + 4]->add($k[$i + 4]));
629 $temp = $m[$i + 1]->add($k[$i + 1]);
631 $temp = $temp->multiply($m[$i + 5]->add($k[$i + 5]));
634 $temp = $m[$i + 2]->add($k[$i + 2]);
636 $temp = $temp->multiply($m[$i + 6]->add($k[$i + 6]));
639 $temp = $m[$i + 3]->add($k[$i + 3]);
641 $temp = $temp->multiply($m[$i + 7]->add($k[$i + 7]));
662 * @param string $m string of length less than 2^64 bytes.
665 private static function L2Hash($k, $m)
680 if (strlen($m) <= 0x20000) { // 2^14 64-bit words
681 $y = self::poly(64, self::$maxwordrange64, $k64, $m);
683 $m_1 = substr($m, 0, 0x20000); // 1 << 17
684 $m_2 = substr($m, 0x20000) . "\x80";
703 * @param string $m string with length divisible by (wordbits / 8) bytes.
706 private static function poly($wordbits, $maxwordrange, $k, $m)
727 $m_i = str_split($m, $wordbytes);
730 // Each input word m is compared with maxwordrange. If not smaller
731 // then 'marker' and (m - offset), both in range, are hashed.
734 foreach ($m_i as $m) {
735 $m = $factory->newInteger(new BigInteger($m, 256));
736 if ($m->compare($maxwordrange) >= 0) {
738 $y = $k->multiply($y)->add($m->subtract($offset));
740 $y = $k->multiply($y)->add($m);
755 * @param string $m string of length 16 bytes.
758 private static function L3Hash($k1, $k2, $m)
764 $m_i = $factory->newInteger(new BigInteger(substr($m, 2 * $i, 2), 256));
1293 * @param string $m
1297 private static function sha512($m, $hash)
1333 $length = strlen($m);
1335 $m .= str_repeat(chr(0), 128 - (($length + 16) & 0x7F));
1336 $m[$length] = chr(0x80);
1338 $m .= pack('N4', 0, 0, 0, $length << 3);
1341 $chunks = str_split($m, 128);