~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/crypto/blowfish/cipher.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
// BlockSize returns the Blowfish block size, 8 bytes.
44
44
// It is necessary to satisfy the Cipher interface in the
45
 
// package "crypto/block".
 
45
// package "crypto/cipher".
46
46
func (c *Cipher) BlockSize() int { return BlockSize }
47
47
 
48
48
// Encrypt encrypts the 8-byte buffer src using the key k
49
49
// and stores the result in dst.
50
50
// Note that for amounts of data larger than a block,
51
51
// it is not safe to just call Encrypt on successive blocks;
52
 
// instead, use an encryption mode like CBC (see crypto/block/cbc.go).
 
52
// instead, use an encryption mode like CBC (see crypto/cipher/cbc.go).
53
53
func (c *Cipher) Encrypt(dst, src []byte) {
54
54
        l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
55
55
        r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])