summaryrefslogtreecommitdiff
path: root/src/crypto/cipher/example_test.go
Commit message (Collapse)AuthorAgeFilesLines
* crypto/cipher: make stream examples runnable in the playgroundYury Smolsky2018-10-301-27/+16
| | | | | | | | | | Updates #9679 Change-Id: I53412cf0142364de5f76e8affc15d607bfa2ad23 Reviewed-on: https://go-review.googlesource.com/c/145838 Run-TryBot: Yury Smolsky <yury@smolsky.by> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
* crypto/cipher: use raw bytes for keys in docsKevin Burke2017-11-161-19/+57
| | | | | | | | | | | | | | | | | | | | Using ASCII values for keys is a bad idea since it makes them vastly easier to guess. Instead, use the same method as the examples in the golang.org/x/crypto/nacl package to load keys from a hex value. Changing the key required updating the ciphertext in many of the examples. I am still worried about the fact the examples ask the user to authenticate messages; authentication isn't trivial, and to be honest it may be better to steer people to a higher level primitive like secretbox, unless people really need AES. Fixes #21012. Change-Id: I8d918cf194694cd380b06c2d561178167ca61adb Reviewed-on: https://go-review.googlesource.com/48596 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* crypto/cipher, math/big: fix example namesJosh Bleecher Snyder2016-08-161-2/+2
| | | | | | | | | | | | Fixes (legit) vet warnings. Fix some verb tenses while we're here. Updates #11041 Change-Id: I27e995f55b38f4cf584e97a67b8545e8247e83d6 Reviewed-on: https://go-review.googlesource.com/27122 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: David Crawshaw <crawshaw@golang.org>
* crypto/cipher: execute AES-GCM decryption exampleTilman Dilo2016-05-091-3/+4
| | | | | | | | | | | | | | | The decryption example for AES-GCM was not executed, hiding the fact that the provided ciphertext could not be authenticated. This commit adds the required output comment, replaces the ciphertext with a working example, and removes an unnecessary string conversion along the way. Change-Id: Ie6729ca76cf4a56c48b33fb3b39872105faa604b Reviewed-on: https://go-review.googlesource.com/22953 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* crypto/cipher: Add AES-GCM encryption and decryption exampleKevin Kirsche2016-01-261-0/+52
| | | | | | | | | | | | | | Add example of how to use the aes package to implement AES encryption and decryption within an application. Per feedback, use more secure AES-GCM implementation as an example in crypto/cipher instead of AES directly. Change-Id: I84453ebb18e0bc79344a24171a031ec0d7ccec2e Reviewed-on: https://go-review.googlesource.com/18803 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+283
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.