From e3c10f3b6709fd4ad55db993cfbebb68fa4b2b84 Mon Sep 17 00:00:00 2001 From: Krishi Shah Date: Mon, 4 Oct 2021 15:27:26 +0100 Subject: [PATCH] rename HexToASCII to BytesToASCIIHex and vice versa --- encoding/bertlv.go | 4 +- encoding/hex.go | 4 +- encoding/hex_test.go | 4 +- field/binary.go | 8 +-- field/bitmap_test.go | 18 +++--- field/composite_test.go | 4 +- message_spec_test.go | 2 +- message_test.go | 4 +- prefix/hex.go | 4 +- sort/strings.go | 4 +- spec87.go | 6 +- specs/builder.go | 4 +- specs/spec87ascii.go | 6 +- specs/spec87hex.go | 132 ++++++++++++++++++++-------------------- 14 files changed, 100 insertions(+), 104 deletions(-) diff --git a/encoding/bertlv.go b/encoding/bertlv.go index 3123ef6e..05fb35e6 100644 --- a/encoding/bertlv.go +++ b/encoding/bertlv.go @@ -14,7 +14,7 @@ type berTLVEncoderTag struct{} // Encode converts ASCII Hex-digits into a byte slice e.g. []byte("AABBCC") // would be converted into []byte{0xAA, 0xBB, 0xCC} func (berTLVEncoderTag) Encode(data []byte) ([]byte, error) { - out, err := ASCIIToHex.Encode(data) + out, err := ASCIIHexToBytes.Encode(data) return out, err } @@ -56,7 +56,7 @@ func (berTLVEncoderTag) Decode(data []byte, length int) ([]byte, int, error) { } } - out, read, err := ASCIIToHex.Decode(data[:tagLenBytes], tagLenBytes) + out, read, err := ASCIIHexToBytes.Decode(data[:tagLenBytes], tagLenBytes) if err != nil { return nil, 0, err } diff --git a/encoding/hex.go b/encoding/hex.go index b6380032..7951db46 100644 --- a/encoding/hex.go +++ b/encoding/hex.go @@ -7,7 +7,7 @@ import ( ) // HEX to ASCII encoder -var HexToASCII = &hexToASCIIEncoder{} +var BytesToASCIIHex = &hexToASCIIEncoder{} type hexToASCIIEncoder struct{} @@ -45,7 +45,7 @@ func (e hexToASCIIEncoder) Decode(data []byte, length int) ([]byte, int, error) } // ASCII To HEX encoder -var ASCIIToHex = &asciiToHexEncoder{} +var ASCIIHexToBytes = &asciiToHexEncoder{} type asciiToHexEncoder struct{} diff --git a/encoding/hex_test.go b/encoding/hex_test.go index 72a1bc06..e61920d9 100644 --- a/encoding/hex_test.go +++ b/encoding/hex_test.go @@ -7,7 +7,7 @@ import ( ) func TestHexToASCIIEncoder(t *testing.T) { - enc := HexToASCII + enc := BytesToASCIIHex got, read, err := enc.Decode([]byte("aabbcc"), 3) require.NoError(t, err) @@ -20,7 +20,7 @@ func TestHexToASCIIEncoder(t *testing.T) { } func TestASCIIToHexEncoder(t *testing.T) { - enc := ASCIIToHex + enc := ASCIIHexToBytes got, read, err := enc.Decode([]byte{0xAA, 0xBB, 0xCC}, 3) require.NoError(t, err) diff --git a/field/binary.go b/field/binary.go index 8e91f623..d33a279a 100644 --- a/field/binary.go +++ b/field/binary.go @@ -113,11 +113,7 @@ func (f *Binary) SetData(data interface{}) error { } func (f *Binary) MarshalJSON() ([]byte, error) { - str, err := f.String() - if err != nil { - return nil, err - } - return json.Marshal(str) + return json.Marshal(f.Value) } func (f *Binary) UnmarshalJSON(b []byte) error { @@ -127,7 +123,7 @@ func (f *Binary) UnmarshalJSON(b []byte) error { return fmt.Errorf("failed to JSON unmarshal bytes to string: %v", err) } - hex, err := encoding.ASCIIToHex.Encode([]byte(v)) + hex, err := encoding.ASCIIHexToBytes.Encode([]byte(v)) if err != nil { return fmt.Errorf("failed to convert ASCII Hex string to bytes") } diff --git a/field/bitmap_test.go b/field/bitmap_test.go index f989d549..ae85c598 100644 --- a/field/bitmap_test.go +++ b/field/bitmap_test.go @@ -12,7 +12,7 @@ func TestHexBitmap(t *testing.T) { t.Run("Read only first bitmap", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -28,7 +28,7 @@ func TestHexBitmap(t *testing.T) { t.Run("Read two bitmaps", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -45,7 +45,7 @@ func TestHexBitmap(t *testing.T) { t.Run("Read three bitmaps", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -62,7 +62,7 @@ func TestHexBitmap(t *testing.T) { t.Run("When not enough data to unpack", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -75,7 +75,7 @@ func TestHexBitmap(t *testing.T) { t.Run("When bit for secondary bitmap is set but not enough data to read", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -89,7 +89,7 @@ func TestHexBitmap(t *testing.T) { t.Run("With primary bitmap only it returns signle bitmap length", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -104,7 +104,7 @@ func TestHexBitmap(t *testing.T) { t.Run("With secondary bitmap it returns length of two bitmaps", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -120,7 +120,7 @@ func TestHexBitmap(t *testing.T) { t.Run("With third bitmap it returns length of three bitmaps", func(t *testing.T) { bitmap := NewBitmap(&Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }) @@ -188,7 +188,7 @@ func TestBinaryBitmap(t *testing.T) { func TestBitmap_SetData(t *testing.T) { spec := &Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, } bitmapBytes := []byte("004000000000000000000000000000000000000000000000") diff --git a/field/composite_test.go b/field/composite_test.go index 386481c8..e3f8b991 100644 --- a/field/composite_test.go +++ b/field/composite_test.go @@ -129,12 +129,12 @@ var ( Subfields: map[string]Field{ "9A": NewString(&Spec{ Description: "Transaction Date", - Enc: encoding.ASCIIToHex, + Enc: encoding.ASCIIHexToBytes, Pref: prefix.BerTLV, }), "9F02": NewString(&Spec{ Description: "Amount, Authorized (Numeric)", - Enc: encoding.ASCIIToHex, + Enc: encoding.ASCIIHexToBytes, Pref: prefix.BerTLV, }), }, diff --git a/message_spec_test.go b/message_spec_test.go index 01510878..f538f8ba 100644 --- a/message_spec_test.go +++ b/message_spec_test.go @@ -21,7 +21,7 @@ func TestMessageSpec_CreateMessageFields(t *testing.T) { }), 1: field.NewBitmap(&field.Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), }, diff --git a/message_test.go b/message_test.go index 826629cc..1c225765 100644 --- a/message_test.go +++ b/message_test.go @@ -25,7 +25,7 @@ func TestMessage(t *testing.T) { }), 1: field.NewBitmap(&field.Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 2: field.NewString(&field.Spec{ @@ -544,7 +544,7 @@ func TestMessageJSON(t *testing.T) { }), 1: field.NewBitmap(&field.Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 2: field.NewString(&field.Spec{ diff --git a/prefix/hex.go b/prefix/hex.go index f9a81b4a..a26860df 100644 --- a/prefix/hex.go +++ b/prefix/hex.go @@ -51,7 +51,7 @@ func (p *hexVarPrefixer) EncodeLength(maxLen, dataLen int) ([]byte, error) { } strLen := strconv.Itoa(dataLen) - res, err := encoding.HexToASCII.Encode([]byte(strLen)) + res, err := encoding.BytesToASCIIHex.Encode([]byte(strLen)) if err != nil { return nil, err } @@ -65,7 +65,7 @@ func (p *hexVarPrefixer) DecodeLength(maxLen int, data []byte) (int, int, error) return 0, 0, fmt.Errorf("length mismatch: want to read %d bytes, get only %d", length, len(data)) } - bDigits, _, err := encoding.HexToASCII.Decode(data[:length], p.Digits) + bDigits, _, err := encoding.BytesToASCIIHex.Decode(data[:length], p.Digits) if err != nil { return 0, 0, err } diff --git a/sort/strings.go b/sort/strings.go index 3eac0632..3b2faa0b 100644 --- a/sort/strings.go +++ b/sort/strings.go @@ -39,11 +39,11 @@ func StringsByInt(x []string) { // of even length. func StringsByHex(x []string) { sort.Slice(x, func(i, j int) bool { - valI, err := encoding.ASCIIToHex.Encode([]byte(x[i])) + valI, err := encoding.ASCIIHexToBytes.Encode([]byte(x[i])) if err != nil { panic(fmt.Sprintf("failed to sort strings by hex: %v", err)) } - valJ, err := encoding.ASCIIToHex.Encode([]byte(x[j])) + valJ, err := encoding.ASCIIHexToBytes.Encode([]byte(x[j])) if err != nil { panic(fmt.Sprintf("failed to sort strings by hex: %v", err)) } diff --git a/spec87.go b/spec87.go index 34300e67..9d89014a 100644 --- a/spec87.go +++ b/spec87.go @@ -21,7 +21,7 @@ var Spec87 *MessageSpec = &MessageSpec{ 1: field.NewBitmap(&field.Spec{ Length: 16, Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 2: field.NewString(&field.Spec{ @@ -330,7 +330,7 @@ var Spec87 *MessageSpec = &MessageSpec{ 52: field.NewString(&field.Spec{ Length: 8, Description: "PIN Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 53: field.NewString(&field.Spec{ @@ -402,7 +402,7 @@ var Spec87 *MessageSpec = &MessageSpec{ 64: field.NewString(&field.Spec{ Length: 8, Description: "Message Authentication Code (MAC)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 70: field.NewString(&field.Spec{ diff --git a/specs/builder.go b/specs/builder.go index 0c3c38ce..caf816ad 100644 --- a/specs/builder.go +++ b/specs/builder.go @@ -59,8 +59,8 @@ var ( "BCD": encoding.BCD, "EBCDIC": encoding.EBCDIC, "Binary": encoding.Binary, - "HexToASCII": encoding.HexToASCII, - "ASCIIToHex": encoding.ASCIIToHex, + "HexToASCII": encoding.BytesToASCIIHex, + "ASCIIToHex": encoding.ASCIIHexToBytes, "LBCD": encoding.LBCD, "BerTLVTag": encoding.BerTLVTag, } diff --git a/specs/spec87ascii.go b/specs/spec87ascii.go index 35a88b28..cc92305a 100644 --- a/specs/spec87ascii.go +++ b/specs/spec87ascii.go @@ -21,7 +21,7 @@ var Spec87ASCII *iso8583.MessageSpec = &iso8583.MessageSpec{ 1: field.NewBitmap(&field.Spec{ Length: 16, Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 2: field.NewString(&field.Spec{ @@ -331,7 +331,7 @@ var Spec87ASCII *iso8583.MessageSpec = &iso8583.MessageSpec{ 52: field.NewString(&field.Spec{ Length: 8, Description: "PIN Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 53: field.NewString(&field.Spec{ @@ -403,7 +403,7 @@ var Spec87ASCII *iso8583.MessageSpec = &iso8583.MessageSpec{ 64: field.NewString(&field.Spec{ Length: 8, Description: "Message Authentication Code (MAC)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 90: field.NewString(&field.Spec{ diff --git a/specs/spec87hex.go b/specs/spec87hex.go index 06e1e8dc..22f2fc83 100644 --- a/specs/spec87hex.go +++ b/specs/spec87hex.go @@ -14,399 +14,399 @@ var Spec87Hex *iso8583.MessageSpec = &iso8583.MessageSpec{ 0: field.NewString(&field.Spec{ Length: 4, Description: "Message Type Indicator", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 1: field.NewBitmap(&field.Spec{ Description: "Bitmap", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 2: field.NewString(&field.Spec{ Length: 19, Description: "Primary Account Number", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 3: field.NewString(&field.Spec{ Length: 6, Description: "Processing Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 4: field.NewString(&field.Spec{ Length: 12, Description: "Transaction Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, Pad: padding.Left('0'), }), 5: field.NewString(&field.Spec{ Length: 12, Description: "Settlement Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, Pad: padding.Left('0'), }), 6: field.NewString(&field.Spec{ Length: 12, Description: "Billing Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, Pad: padding.Left('0'), }), 7: field.NewString(&field.Spec{ Length: 10, Description: "Transmission Date & Time", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 8: field.NewString(&field.Spec{ Length: 8, Description: "Billing Fee Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 9: field.NewString(&field.Spec{ Length: 8, Description: "Settlement Conversion Rate", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 10: field.NewString(&field.Spec{ Length: 8, Description: "Cardholder Billing Conversion Rate", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 11: field.NewString(&field.Spec{ Length: 6, Description: "Systems Trace Audit Number (STAN)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 12: field.NewString(&field.Spec{ Length: 6, Description: "Local Transaction Time", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 13: field.NewString(&field.Spec{ Length: 4, Description: "Local Transaction Date", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 14: field.NewString(&field.Spec{ Length: 4, Description: "Expiration Date", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 15: field.NewString(&field.Spec{ Length: 4, Description: "Settlement Date", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 16: field.NewString(&field.Spec{ Length: 4, Description: "Currency Conversion Date", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 17: field.NewString(&field.Spec{ Length: 4, Description: "Capture Date", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 18: field.NewString(&field.Spec{ Length: 4, Description: "Merchant Type", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 19: field.NewString(&field.Spec{ Length: 3, Description: "Acquiring Institution Country Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 20: field.NewString(&field.Spec{ Length: 3, Description: "PAN Extended Country Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 21: field.NewString(&field.Spec{ Length: 3, Description: "Forwarding Institution Country Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 22: field.NewString(&field.Spec{ Length: 3, Description: "Point of Sale (POS) Entry Mode", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 23: field.NewString(&field.Spec{ Length: 3, Description: "Card Sequence Number (CSN)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 24: field.NewString(&field.Spec{ Length: 3, Description: "Function Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 25: field.NewString(&field.Spec{ Length: 2, Description: "Point of Service Condition Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 26: field.NewString(&field.Spec{ Length: 2, Description: "Point of Service PIN Capture Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 27: field.NewString(&field.Spec{ Length: 1, Description: "Authorizing Identification Response Length", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 28: field.NewString(&field.Spec{ Length: 9, Description: "Transaction Fee Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 29: field.NewString(&field.Spec{ Length: 9, Description: "Settlement Fee Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 30: field.NewString(&field.Spec{ Length: 9, Description: "Transaction Processing Fee Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 31: field.NewString(&field.Spec{ Length: 9, Description: "Settlement Processing Fee Amount", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 32: field.NewString(&field.Spec{ Length: 11, Description: "Acquiring Institution Identification Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 33: field.NewString(&field.Spec{ Length: 11, Description: "Forwarding Institution Identification Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 34: field.NewString(&field.Spec{ Length: 28, Description: "Extended Primary Account Number", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 35: field.NewString(&field.Spec{ Length: 37, Description: "Track 2 Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 36: field.NewString(&field.Spec{ Length: 104, Description: "Track 3 Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 37: field.NewString(&field.Spec{ Length: 12, Description: "Retrieval Reference Number", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 38: field.NewString(&field.Spec{ Length: 6, Description: "Authorization Identification Response", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 39: field.NewString(&field.Spec{ Length: 2, Description: "Response Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 40: field.NewString(&field.Spec{ Length: 3, Description: "Service Restriction Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 41: field.NewString(&field.Spec{ Length: 8, Description: "Card Acceptor Terminal Identification", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 42: field.NewString(&field.Spec{ Length: 15, Description: "Card Acceptor Identification Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 43: field.NewString(&field.Spec{ Length: 40, Description: "Card Acceptor Name/Location", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 44: field.NewString(&field.Spec{ Length: 99, Description: "Additional Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 45: field.NewString(&field.Spec{ Length: 76, Description: "Track 1 Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LL, }), 46: field.NewString(&field.Spec{ Length: 999, Description: "Additional data (ISO)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 47: field.NewString(&field.Spec{ Length: 999, Description: "Additional data (National)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 48: field.NewString(&field.Spec{ Length: 999, Description: "Additional data (Private)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 49: field.NewString(&field.Spec{ Length: 3, Description: "Transaction Currency Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 50: field.NewString(&field.Spec{ Length: 3, Description: "Settlement Currency Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 51: field.NewString(&field.Spec{ Length: 3, Description: "Cardholder Billing Currency Code", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 52: field.NewString(&field.Spec{ Length: 16, Description: "PIN Data", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 53: field.NewString(&field.Spec{ Length: 16, Description: "Security Related Control Information", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 54: field.NewString(&field.Spec{ Length: 120, Description: "Additional Amounts", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 55: field.NewString(&field.Spec{ Length: 999, Description: "ICC Data – EMV Having Multiple Tags", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 56: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (ISO)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 57: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (National)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 58: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (National)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 59: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (National)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 60: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (National)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 61: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (Private)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 62: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (Private)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 63: field.NewString(&field.Spec{ Length: 999, Description: "Reserved (Private)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.LLL, }), 64: field.NewString(&field.Spec{ Length: 8, Description: "Message Authentication Code (MAC)", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), 90: field.NewString(&field.Spec{ Length: 42, Description: "Original Data Elements", - Enc: encoding.HexToASCII, + Enc: encoding.BytesToASCIIHex, Pref: prefix.Hex.Fixed, }), },