# README
Strutil
A collection of helper functions to deal with string encoding/decoding, generation.
Feel free to add new functions or improve the existing code.
Install
go get github.com/iconmobile-dev/go-core/strutil
Usage and Examples
strutil.Encrypt
encrypts data using 256-bit AES-GCM.
strutil.Decrypt
decrypts data using 256-bit AES-GCM.
strutil.Random
generates a NOT SECURE!
random string of defined length.
strutil.RandomSecure
generates a SECURELY random string of defined length and type: alpha
, number
, alpha-numeric
strutil.Hash
generates a hash of data using HMAC-SHA-512/256.
# Functions
Decrypt decrypts data using 256-bit AES-GCM.
Encrypt encrypts data using 256-bit AES-GCM.
Hash generates a hash of data using HMAC-SHA-512/256 and adds the description text as HMAC "key" to get different hashes for different purposes.
Random generates a NOT SECURE! random string of defined length The result is NOT SECURE but fast because it uses the time as seed taken from https://goo.gl/9GBmNN.
RandomSecure returns a SECURELY generated random string randType can be: - "alpha" for range A-Z a-z - "number" for range 0-9, returns string number with leading 0s - "pin" for range 1-9 A-Z without O, I letters - any other value for A-Z a-z 0-9 It will panic in the super rare case of an issue to avoid any cascading security issues orients on https://goo.gl/kK987i and https://goo.gl/NRrS7y.