Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "crypto/aes"
- "sync"
- )
- func main() {
- N := 10000
- key := []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}
- in := []byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34}
- out := []byte{0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32}
- c, err := aes.NewCipher(key)
- if err != nil {
- panic(err)
- }
- wg := sync.WaitGroup{}
- wg.Add(N)
- for j := 0; j < N; j++ {
- go func() {
- encrypted := make([]byte, len(in))
- c.Encrypt(encrypted, in)
- wg.Done()
- }()
- }
- wg.Wait()
- wg.Add(N)
- for j := 0; j < N; j++ {
- go func() {
- decrypted := make([]byte, len(in))
- c.Decrypt(decrypted, out)
- wg.Done()
- }()
- }
- wg.Wait()
- }
Add Comment
Please, Sign In to add comment