Source File
cipher.go
Belonging Package
golang.org/x/crypto/blowfish
package blowfish // import "golang.org/x/crypto/blowfish"
import
const BlockSize = 8
func ( []byte) (*Cipher, error) {
var Cipher
if := len(); < 1 || > 56 {
return nil, KeySizeError()
}
initCipher(&)
ExpandKey(, &)
return &, nil
}
func (, []byte) (*Cipher, error) {
if len() == 0 {
return NewCipher()
}
var Cipher
if := len(); < 1 {
return nil, KeySizeError()
}
initCipher(&)
expandKeyWithSalt(, , &)
return &, nil
}
func ( *Cipher) (, []byte) {
:= uint32([0])<<24 | uint32([1])<<16 | uint32([2])<<8 | uint32([3])
:= uint32([4])<<24 | uint32([5])<<16 | uint32([6])<<8 | uint32([7])
, = encryptBlock(, , )
[0], [1], [2], [3] = byte(>>24), byte(>>16), byte(>>8), byte()
[4], [5], [6], [7] = byte(>>24), byte(>>16), byte(>>8), byte()
}
func ( *Cipher) (, []byte) {
:= uint32([0])<<24 | uint32([1])<<16 | uint32([2])<<8 | uint32([3])
:= uint32([4])<<24 | uint32([5])<<16 | uint32([6])<<8 | uint32([7])
, = decryptBlock(, , )
[0], [1], [2], [3] = byte(>>24), byte(>>16), byte(>>8), byte()
[4], [5], [6], [7] = byte(>>24), byte(>>16), byte(>>8), byte()
}
func ( *Cipher) {
copy(.p[0:], p[0:])
copy(.s0[0:], s0[0:])
copy(.s1[0:], s1[0:])
copy(.s2[0:], s2[0:])
copy(.s3[0:], s3[0:])
![]() |
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. |