Documentation
¶
Index ¶
- Constants
- func BytesToHex(data []byte) string
- func BytesToNibbles(byts []byte) []byte
- func CoalesceBytes(a []byte, others ...[]byte) []byte
- func CoalesceString(a string, others ...string) string
- func ComputeKCV(key []byte) ([]byte, error)
- func Crypt(c cipher.BlockMode, data []byte) []byte
- func DecodePINBlock0(pan string, pinblock []byte) (pin string, err error)
- func Decrypt3DES_CBC(key, iv, data []byte) ([]byte, error)
- func Decrypt3DES_ECB(key, data []byte) ([]byte, error)
- func DecryptAES_CBC(key, iv, data []byte) ([]byte, error)
- func DecryptAES_ECB(key, data []byte) ([]byte, error)
- func DecryptCBC(c cipher.Block, iv, data []byte) ([]byte, error)
- func DecryptDES_CBC(key, iv, data []byte) ([]byte, error)
- func DecryptDES_ECB(key, data []byte) ([]byte, error)
- func DecryptECB(c cipher.Block, data []byte) ([]byte, error)
- func DecryptPINBlock0(key []byte, pan string, encryptedPinblock []byte) (pin string, err error)
- func EncodePINBlock0(pan, pin string) ([]byte, error)
- func Encrypt3DES_CBC(key, iv, data []byte) ([]byte, error)
- func Encrypt3DES_ECB(key, data []byte) ([]byte, error)
- func EncryptAES_CBC(key, iv, data []byte) ([]byte, error)
- func EncryptAES_ECB(key, data []byte) ([]byte, error)
- func EncryptCBC(c cipher.Block, iv, data []byte) ([]byte, error)
- func EncryptDES_CBC(key, iv, data []byte) ([]byte, error)
- func EncryptDES_ECB(key, data []byte) ([]byte, error)
- func EncryptECB(c cipher.Block, data []byte) ([]byte, error)
- func EncryptPINBlock0(key []byte, pan, pin string) ([]byte, error)
- func GenerateCVV(cvk []byte, pan string, expirationDate, serviceCode string) (string, error)
- func IndentString(text, indent string) string
- func InvertBits(data []byte) []byte
- func NewECBDecrypter(c cipher.Block) cipher.BlockMode
- func NewECBEncrypter(c cipher.Block) cipher.BlockMode
- func NewTripleDESCipher(key []byte) (cipher.Block, error)
- func NewValidationError(errs ...error) error
- func NibblesToBytes(nibbles []byte) []byte
- func NibblesToHex(nibbles []byte) string
- func Pad80(data []byte, skipIfExact bool) []byte
- func PadLeft(data []byte, padbyte byte, totalLength int) []byte
- func PadRight(data []byte, padbyte byte, totalLength int) []byte
- func ParseHexNibbles(src string) ([]byte, error)
- func RandomBytes(numberOfBytes int) ([]byte, error)
- func SetNibble(slice []byte, index int, nibble uint8)
- func SetParityEven(data []byte)
- func SetParityOdd(data []byte)
- func SliceOfDigits(n uint64) []int
- func ToBCD(n uint) []byte
- func TruncateLeft(data []byte, totalLength int) []byte
- func TruncateRight(data []byte, totalLength int) []byte
- func XOR(a []byte, others ...[]byte) []byte
- func XORInPlace(data, other []byte)
- type KeyType
- type RawTrack1Data
- type RawTrack2Data
Constants ¶
const ErrInvalidArguments stringError = "invalid arguments"
Variables ¶
This section is empty.
Functions ¶
func BytesToHex ¶ added in v0.0.2
func BytesToNibbles ¶
func CoalesceBytes ¶ added in v0.0.2
func CoalesceString ¶ added in v0.0.2
func ComputeKCV ¶
func Decrypt3DES_CBC ¶
func Decrypt3DES_ECB ¶
func DecryptAES_CBC ¶
func DecryptAES_ECB ¶
func DecryptDES_CBC ¶
func DecryptDES_ECB ¶
func DecryptPINBlock0 ¶
func EncodePINBlock0 ¶
func Encrypt3DES_CBC ¶
func Encrypt3DES_ECB ¶
func EncryptAES_CBC ¶
func EncryptAES_ECB ¶
func EncryptDES_CBC ¶
func EncryptDES_ECB ¶
func GenerateCVV ¶ added in v0.0.4
func IndentString ¶ added in v0.0.3
func InvertBits ¶
func NewValidationError ¶
func NibblesToBytes ¶
func NibblesToHex ¶
func Pad80 ¶
Pad80 pads the data with byte 0x80 and then 0x00s until the data is an exact multiple of the block size.
`skipIfExact` controls if an entire block should be added when the data is an exact multiple of the block size or if the padding should be skipped entirely.
func ParseHexNibbles ¶
func RandomBytes ¶
func SetParityEven ¶
func SetParityEven(data []byte)
func SetParityOdd ¶
func SetParityOdd(data []byte)
func SliceOfDigits ¶ added in v0.0.3
func TruncateLeft ¶
TruncateLeft discards bytes at the left until the length is equal the specified. If the length of the data is already equal to or shorter than `totalLength`, the data will be returned unchanged.
func TruncateRight ¶
TruncateRight discards bytes at the right until the length is equal the specified. If the length of the data is already equal to or shorter than `totalLength`, the data will be returned unchanged.
func XOR ¶
XOR performs an Exclusive Or operation on the data and returns a slice with the results. This function does not mutate the slices fed into it.
If the length of `other` is smaller than the length of `a`, it will be padded to the left, adding zeroes to the left of b. If the length of `other` is greater than the length of `a`, it will be truncated to the left, removing the most significant bits.
func XORInPlace ¶
func XORInPlace(data, other []byte)
XORInPlace performs an Exclusive Or operation on the data mutating it.
If the length of `other` is smaller than the length of `data`, it will be truncated to the left, removing the most significant bits. If the length of `other` is greater than the length of `data`, it will be padded to the left, adding zeroes to the left.
Types ¶
type KeyType ¶
type KeyType string
const ( KeyZMK KeyType = "ZMK" KeyAS2805_KCA KeyType = "AS2805-KCA" KeyAS2805_KEKr KeyType = "AS2805-KEKr" KeyAS2805_KEKs KeyType = "AS2805-KEKs" KeyAS2805_KI KeyType = "AS2805-KI" KeyAS2805_KIA KeyType = "AS2805-KIA" KeyAS2805_KMA KeyType = "AS2805-KMA" KeyAS2805_KT KeyType = "AS2805-KT" KeyAS2805_PEK KeyType = "AS2805-PEK" KeyAS2805_TAKr KeyType = "AS2805-TAKr" KeyAS2805_TAKs KeyType = "AS2805-TAKs" KeyAS2805_TEK KeyType = "AS2805-TEK" KeyAS2805_TEKr KeyType = "AS2805-TEKr" KeyAS2805_TEKs KeyType = "AS2805-TEKs" KeyAS2805_TK KeyType = "AS2805-TK" KeyAS2805_TMK1 KeyType = "AS2805-TMK1" KeyAS2805_TMK2 KeyType = "AS2805-TMK2" KeyAS2805_ZAKr KeyType = "AS2805-ZAKr" KeyAS2805_ZAKs KeyType = "AS2805-ZAKs" KeyAS2805_ZEKr KeyType = "AS2805-ZEKr" KeyAS2805_ZEKs KeyType = "AS2805-ZEKs" KeyBDK_1 KeyType = "BDK-1" KeyBDK_2 KeyType = "BDK-2" KeyBDK_3 KeyType = "BDK-3" KeyBDK_4 KeyType = "BDK-4" KeyCK_DEK KeyType = "CK-DEK" KeyCK_ENK KeyType = "CK-ENK" KeyCK_MAC KeyType = "CK-MAC" KeyCSCK KeyType = "CSCK" KeyCVK KeyType = "CVK" KeyDEK KeyType = "DEK" KeyHMAC KeyType = "HMAC" KeyIKEY KeyType = "IKEY" KeyIPEK KeyType = "IPEK" KeyKD_PERSO KeyType = "KD-PERSO" KeyKEK KeyType = "KEK" KeyKMC KeyType = "KMC" KeyKML KeyType = "KML" KeyMK_AC KeyType = "MK-AC" KeyMK_AS KeyType = "MK-AS" KeyMK_CVC3 KeyType = "MK-CVC3" KeyMK_DAC KeyType = "MK-DAC" KeyMK_DN KeyType = "MK-DN" KeyMK_KE KeyType = "MK-KE" KeyMK_SMC KeyType = "MK-SMC" KeyMK_SMI KeyType = "MK-SMI" KeyMK KeyType = "MK" KeyOBKM_BKAM KeyType = "OBKM-BKAM" KeyOBKM_BKEM KeyType = "OBKM-BKEM" KeyOBKM_KI_S5 KeyType = "OBKM-KIS.5" KeyOBKM_KM3L KeyType = "OBKM-KM3L" KeyOBKM_KM3LISS KeyType = "OBKM-KM3LISS" KeyOBKM_KM3X KeyType = "OBKM-KM3X" KeyOBKM_KM3XISS KeyType = "OBKM-KM3XISS" KeyOBKM_KMACACQ KeyType = "OBKM-KMACACQ" KeyOBKM_KMACACX KeyType = "OBKM-KMACACX" KeyOBKM_KMACCI KeyType = "OBKM-KMACCI" KeyOBKM_KMACISS KeyType = "OBKM-KMACISS" KeyOBKM_KMACMA KeyType = "OBKM-KMACMA" KeyOBKM_KMACS4 KeyType = "OBKM-KMACS4" KeyOBKM_KMACS5 KeyType = "OBKM-KMACS5" KeyOBKM_KMACUPD KeyType = "OBKM-KMACUPD" KeyOBKM_KML KeyType = "OBKM-KML" KeyOBKM_KMLISS KeyType = "OBKM-KMLISS" KeyOBKM_KMP KeyType = "OBKM-KMP" KeyOBKM_KMPISS KeyType = "OBKM-KMPISS" KeyOBKM_KMSCISS KeyType = "OBKM-KMSCISS" KeyOBKM_KMX KeyType = "OBKM-KMX" KeyOBKM_KMXISS KeyType = "OBKM-KMXISS" KeyOBKM_PVVK KeyType = "OBKM-PVVK" KeyPEK KeyType = "PEK" KeyPVK KeyType = "PVK" KeyRSA_PK KeyType = "RSA-PK" KeyRSA_SK KeyType = "RSA-SK" KeySK_DEK KeyType = "SK-DEK" KeySK_ENC KeyType = "SK-ENC" KeySK_MAC KeyType = "SK-MAC" KeyTAK KeyType = "TAK" KeyTEK KeyType = "TEK" KeyTKR KeyType = "TKR" KeyTMK KeyType = "TMK" KeyTPK KeyType = "TPK" KeyWWK KeyType = "WWK" KeyZAK KeyType = "ZAK" KeyZEK KeyType = "ZEK" KeyZMK_Component KeyType = "ZMK-Component" KeyZPK KeyType = "ZPK" )
func KeyTypeByName ¶
func (KeyType) Description ¶
type RawTrack1Data ¶
type RawTrack1Data struct { FormatCode string CardNumber string CountryCode string CardholderName string ExpirationDate string ServiceCode string DiscretionaryData string }
func RawParseTrack1 ¶
func RawParseTrack1(track string) (RawTrack1Data, error)
type RawTrack2Data ¶
type RawTrack2Data struct { CardNumber string ExpirationDate string ServiceCode string DiscretionaryData string }
func RawParseTrack2 ¶
func RawParseTrack2(track string) (RawTrack2Data, error)
func RawParseTrack2EquivalentData ¶
func RawParseTrack2EquivalentData(track []byte) (RawTrack2Data, error)