aria-go
Go implementation of the ARIA encryption algorithm.
Installation
go get -u github.com/hallazzang/aria-go
Usage
This package is compatible with the standard crypto
package.
package main
import (
"fmt"
"github.com/hallazzang/aria-go"
)
func main() {
key := []byte("0123456789abcdef")
plaintext := []byte("fedcba9876543210")
block, err := aria.NewCipher(key)
if err != nil {
panic(err)
}
fmt.Printf("plaintext: %s\n", plaintext)
ciphertext := make([]byte, 16)
block.Encrypt(ciphertext, plaintext)
fmt.Printf("ciphertext: % x\n", ciphertext)
decrypted := make([]byte, 16)
block.Decrypt(decrypted, ciphertext)
fmt.Printf("decrypted: %s\n", decrypted)
}
This will print out:
plaintext: fedcba9876543210
ciphertext: 93 52 1e f2 67 65 0b d1 fc 75 20 5a d3 44 4d 9d
decrypted: fedcba9876543210
Benchmarks
Here's the benchmark result compared with aes
package:
goos: windows
goarch: amd64
BenchmarkAES128 100000000 17.7 ns/op 0 B/op 0 allocs/op
BenchmarkAES192 100000000 21.0 ns/op 0 B/op 0 allocs/op
BenchmarkAES256 100000000 23.2 ns/op 0 B/op 0 allocs/op
BenchmarkARIA128 1000000 1225 ns/op 0 B/op 0 allocs/op
BenchmarkARIA192 1000000 1468 ns/op 0 B/op 0 allocs/op
BenchmarkARIA256 1000000 1610 ns/op 0 B/op 0 allocs/op
License
MIT