crypto/cipher: Add ECB support #5597
Closed
Labels
Comments
IV are supposed to be public and shouldn't be encrypted, but anyway... ECB is essentially "no mode" and while it isn't supported in a named fashion, crypto/cipher.Block.Encrypt and Decrypt implement it on a block by block basis. You just need to feed in a multiple of the blocksize: bs := block.BlockSize() if len(plaintext) % bs != 0 { panic("Need a multiple of the blocksize") } ciphertext := make([]byte, len(plaintext)) for len(plaintext) > 0 { block.Encrypt(ciphertext, plaintext) plaintext = plaintext[bs:] ciphertext = ciphertext[bs:] } [1] http://golang.org/pkg/crypto/cipher/#Block Status changed to WontFix. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by hebipp1:
The text was updated successfully, but these errors were encountered: