Created
July 29, 2017 16:15
-
-
Save starius/2f629d22eacbb09a33c28a6ca678b80c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/aes" | |
"fmt" | |
"time" | |
"golang.org/x/crypto/twofish" | |
) | |
func main() { | |
c, err := twofish.NewCipher([]byte("0123456789abcdef0123456789ABCDEF")) | |
if err != nil { | |
panic(err) | |
} | |
block := []byte("0123456789abcdef") | |
t1 := time.Now() | |
for i := 0; i < 67108864; i++ { | |
c.Encrypt(block, block) | |
} | |
delta := time.Since(t1) | |
fmt.Printf("Encryption of 1GB with twofish takes %v.\n", delta) | |
// | |
c1, err := aes.NewCipher([]byte("0123456789abcdef0123456789ABCDEF")) | |
if err != nil { | |
panic(err) | |
} | |
t2 := time.Now() | |
for i := 0; i < 67108864; i++ { | |
c1.Encrypt(block, block) | |
} | |
delta2 := time.Since(t2) | |
fmt.Printf("Encryption of 1GB with AES takes %v.\n", delta2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment