Skip to content

Commit

Permalink
Rename cipher interface
Browse files Browse the repository at this point in the history
  • Loading branch information
riobard committed Feb 5, 2017
1 parent b9c9bb2 commit a25fd3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cipher/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var streamList = map[string]struct {
"chacha20-ietf": {32, newChacha20ietf},
}

// ListCiphers returns a list of available cipher names sorted alphabetically.
func ListCiphers() []string {
// List returns a list of available cipher names sorted alphabetically.
func List() []string {
var l []string
for k := range aeadList {
l = append(l, k)
Expand All @@ -59,8 +59,8 @@ func ListCiphers() []string {
return l
}

// MakeCipher returns a pair of ciphers for the given key.
func MakeCipher(name string, key []byte) (core.StreamConnCipher, core.PacketConnCipher, error) {
// New returns a pair of ciphers for the given key.
func New(name string, key []byte) (core.StreamConnCipher, core.PacketConnCipher, error) {
name = strings.ToLower(name)

if choice, ok := aeadList[name]; ok {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func main() {
flag.Parse()

if flags.Cipher == "" {
ls := cipher.ListCiphers()
ls := cipher.List()
fmt.Fprintf(os.Stderr, "# available ciphers\n")
for _, each := range ls {
fmt.Fprintf(os.Stderr, "%s\n", each)
Expand All @@ -66,7 +66,7 @@ func main() {
log.Fatalf("key: %v", err)
}

streamCipher, packetCipher, err := cipher.MakeCipher(flags.Cipher, key)
streamCipher, packetCipher, err := cipher.New(flags.Cipher, key)
if err != nil {
log.Fatalf("cipher: %v", err)
}
Expand Down

0 comments on commit a25fd3c

Please sign in to comment.