// Copyright 2009 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.// MD4 block step.// In its own file so that a faster assembly or C version// can be substituted easily.package md4importvar shift1 = []int{3, 7, 11, 19}var shift2 = []int{3, 5, 9, 13}var shift3 = []int{3, 9, 11, 15}var xIndex2 = []uint{0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15}var xIndex3 = []uint{0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}func _Block( *digest, []byte) int { := .s[0] := .s[1] := .s[2] := .s[3] := 0var [16]uint32forlen() >= _Chunk { , , , := , , , := 0for := 0; < 16; ++ { [] = uint32([]) | uint32([+1])<<8 | uint32([+2])<<16 | uint32([+3])<<24 += 4 }// If this needs to be made faster in the future, // the usual trick is to unroll each of these // loops by a factor of 4; that lets you replace // the shift[] lookups with constants and, // with suitable variable renaming in each // unrolled body, delete the a, b, c, d = d, a, b, c // (or you can let the optimizer do the renaming). // // The index variables are uint so that % by a power // of two can be optimized easily by a compiler.// Round 1.for := uint(0); < 16; ++ { := := shift1[%4] := (( ^ ) & ) ^ += + [] = bits.RotateLeft32(, ) , , , = , , , }// Round 2.for := uint(0); < 16; ++ { := xIndex2[] := shift2[%4] := ( & ) | ( & ) | ( & ) += + [] + 0x5a827999 = bits.RotateLeft32(, ) , , , = , , , }// Round 3.for := uint(0); < 16; ++ { := xIndex3[] := shift3[%4] := ^ ^ += + [] + 0x6ed9eba1 = bits.RotateLeft32(, ) , , , = , , , } += += += += = [_Chunk:] += _Chunk } .s[0] = .s[1] = .s[2] = .s[3] = return}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.