Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Panic on strings with trailing zeros #10

Closed
anitgandhi opened this issue Oct 11, 2017 · 0 comments
Closed

Panic on strings with trailing zeros #10

anitgandhi opened this issue Oct 11, 2017 · 0 comments

Comments

@anitgandhi
Copy link
Contributor

Description of Issue

This is a tracking bug based on #9

Steps to Reproduce

package main

import (
	"fmt"
	"github.com/capitalone/fpe/ff1"
)

// Note: panic(err) is just used for example purposes.
func main() {
	key := []byte{0x4, 0x8, 0x15, 0x16, 0x23, 0x42, 0x4, 0x8, 0x15, 0x16, 0x23, 0x42, 0x4, 0x8, 0x15, 0x16, 0x23, 0x42, 0x4, 0x8, 0x15, 0x16, 0x23, 0x42}
	tweak := []byte{0x42}

	// Create a new FF1 cipher "object"
	// 10 is the radix/base, and 8 is the tweak length.
	ciph, err := ff1.NewCipher(10, 8, key, tweak)
	if err != nil {
		panic(err)
	}

	original := "750000000"

	// Call the encryption function on an example test vector
	ciphertext, err := ciph.Encrypt(original)
	if err != nil {
		fmt.Println(err)
	}

	fmt.Println(ciphertext)
}

What did you expect to see?

Not a panic

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant