Skip to content

Instantly share code, notes, and snippets.

@starius
Created July 29, 2017 16:46
Show Gist options
  • Save starius/a6d8df81f0695c94dd03c872b735467c to your computer and use it in GitHub Desktop.
Save starius/a6d8df81f0695c94dd03c872b735467c to your computer and use it in GitHub Desktop.
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