func cryptBlock(subkeys []uint64, dst, src []byte, decrypt bool) { … } // DES Feistel function. feistelBox must be initialized via // feistelBoxOnce.Do(initFeistelBox) first. func feistel(l, r uint32, k0, k1 uint64) (lout, rout uint32) { … } var feistelBox … var feistelBoxOnce … // general purpose function to perform DES block permutations. func permuteBlock(src uint64, permutation []uint8) (block uint64) { … } func initFeistelBox() { … } // permuteInitialBlock is equivalent to the permutation defined // by initialPermutation. func permuteInitialBlock(block uint64) uint64 { … } // permuteFinalBlock is equivalent to the permutation defined // by finalPermutation. func permuteFinalBlock(block uint64) uint64 { … } // creates 16 28-bit blocks rotated according // to the rotation schedule. func ksRotate(in uint32) (out []uint32) { … } // creates 16 56-bit subkeys from the original key. func (c *desCipher) generateSubkeys(keyBytes []byte) { … } // Expand 48-bit input to 64-bit, with each 6-bit block padded by extra two bits at the top. // By doing so, we can have the input blocks (four bits each), and the key blocks (six bits each) well-aligned without // extra shifts/rotations for alignments. func unpack(x uint64) uint64 { … }