https://github.com/hazcod/gosecurity
Security library for Go, contains multihash-like library or encryption.
https://github.com/hazcod/gosecurity
Last synced: about 1 year ago
JSON representation
Security library for Go, contains multihash-like library or encryption.
- Host: GitHub
- URL: https://github.com/hazcod/gosecurity
- Owner: hazcod
- License: mit
- Created: 2018-10-10T12:02:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-12T08:31:10.000Z (almost 2 years ago)
- Last Synced: 2024-07-12T09:54:20.996Z (almost 2 years ago)
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gosecurity [](https://goreportcard.com/report/hazcod/gosecurity) [](https://codebeat.co/projects/github-com-hazcod-gosecurity-master) [](https://github.com/HazCod/gosecurity/blob/master/LICENSE)
Wrapper library that contains security-related stuff.
### gocrypto
Encrypt and decrypt stuff using authenticated state-of-the-art crypto, provided by golang.org/x/crypto/nacl/secretbox.
#### usage
```
func GenerateKey() ([]byte, error)
func Encrypt(input []byte, key []byte) ([]byte, error)
func Decrypt(input []byte, key []byte) ([]byte, error)
```
#### format
```
```
### gohash
Formats your password hashes in a standard (multihash-like) format so it keeps on working whenever you change algo.
Defaults to Argon2id from golang.org/x/crypto/argon2.
#### usage
```
func GetHash(input string) (string, error)
func VerifyHash(hash string, input string) (bool, error)
func NeedsRehash(hash string) (bool, error)
```
#### format
```
$argon2$i:4:65536$IO+amcBFUXUETmI=$GpiSk2q1+y2DyfRVsg13BmIGE/oM0GLcM0SOs0s/H/s=
$$$salt$key$
```
Where parameters contains information for the specific hashing algorhitm, such as size/modus/memory.