Source File
block.go
Belonging Package
crypto/des
package des
import (
)
func ( []uint64, , []byte, bool) {
:= binary.BigEndian.Uint64()
= permuteInitialBlock()
, := uint32(>>32), uint32()
= ( << 1) | ( >> 31)
= ( << 1) | ( >> 31)
if {
for := 0; < 8; ++ {
, = feistel(, , [15-2*], [15-(2*+1)])
}
} else {
for := 0; < 8; ++ {
, = feistel(, , [2*], [2*+1])
}
}
= ( << 31) | ( >> 1)
= ( << 31) | ( >> 1)
func ( []uint64, , []byte) {
cryptBlock(, , , false)
}
func ( []uint64, , []byte) {
cryptBlock(, , , true)
}
func (, uint32, , uint64) (, uint32) {
var uint32
= ^ uint32(>>32)
^= feistelBox[7][&0x3f] ^
feistelBox[5][(>>8)&0x3f] ^
feistelBox[3][(>>16)&0x3f] ^
feistelBox[1][(>>24)&0x3f]
= (( << 28) | ( >> 4)) ^ uint32()
^= feistelBox[6][()&0x3f] ^
feistelBox[4][(>>8)&0x3f] ^
feistelBox[2][(>>16)&0x3f] ^
feistelBox[0][(>>24)&0x3f]
= ^ uint32(>>32)
^= feistelBox[7][&0x3f] ^
feistelBox[5][(>>8)&0x3f] ^
feistelBox[3][(>>16)&0x3f] ^
feistelBox[1][(>>24)&0x3f]
= (( << 28) | ( >> 4)) ^ uint32()
^= feistelBox[6][()&0x3f] ^
feistelBox[4][(>>8)&0x3f] ^
feistelBox[2][(>>16)&0x3f] ^
feistelBox[0][(>>24)&0x3f]
return ,
}
var feistelBox [8][64]uint32
var feistelBoxOnce sync.Once
= ( << 1) | ( >> 31)
feistelBox[][] = uint32()
}
}
}
}
:= >> 48
:= << 48
^= ^ ^ <<48 ^ >>48
= >> 32 & 0xff00ff
= ( & 0xff00ff00)
^= <<32 ^ ^ <<8 ^ <<24 // exchange b0 b4 with b3 b7
= & 0x0f0f00000f0f0000
= & 0x0000f0f00000f0f0
^= ^ ^ >>12 ^ <<12
= & 0x3300330033003300
= & 0x00cc00cc00cc00cc
^= ^ ^ >>6 ^ <<6
= & 0xaaaaaaaa55555555
^= ^ >>33 ^ <<33
return
}
:= & 0xaaaaaaaa55555555
^= ^ >>33 ^ <<33
= & 0x3300330033003300
:= & 0x00cc00cc00cc00cc
^= ^ ^ >>6 ^ <<6
= & 0x0f0f00000f0f0000
= & 0x0000f0f00000f0f0
^= ^ ^ >>12 ^ <<12
= >> 32 & 0xff00ff
= ( & 0xff00ff00)
^= <<32 ^ ^ <<8 ^ <<24
= >> 48
= << 48
^= ^ ^ <<48 ^ >>48
return
}
:= ( << (4 + ksRotations[])) >> 4
:= ( << 4) >> (32 - ksRotations[])
[] = |
= []
}
return
}
func ( *desCipher) ( []byte) {
feistelBoxOnce.Do(initFeistelBox)
:= binary.BigEndian.Uint64()
:= permuteBlock(, permutedChoice1[:])
.subkeys[] = unpack(permuteBlock(, permutedChoice2[:]))
}
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin 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. |