Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathisve/gohashingexample
Basic sha 265 hashing example
https://github.com/mathisve/gohashingexample
Last synced: about 2 months ago
JSON representation
Basic sha 265 hashing example
- Host: GitHub
- URL: https://github.com/mathisve/gohashingexample
- Owner: mathisve
- Created: 2019-09-28T01:17:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-30T11:40:04.000Z (about 5 years ago)
- Last Synced: 2024-06-20T23:58:23.742Z (6 months ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# goHashingExample
Basic SHA 265 example in golang.Could be used to store passwords, emails, ect.
# How to use
```golang
var username string = "username"
var password string = "password"
hashedLogin := hashing.HashLoginInfo(username, password)
fmt.Println(hashedLogin)
```
# main.go output```
Mathiss-iMac:goHashingExample mathis$ go run main.go
Type username: mathis
Type password: test123
Hashed username: c413eb8a7c9415f5f8ab446ee87b55f6d636d63c1af34c861949d6a300b8f6c7
Hashed password: 28742e3f48057028d5bfe3cf825e6a94cc6cbfbaa27ca7e7269a60563b76e90c
Hashing salt: k47DbTjjPeqVuDq9xrh2KqQQGXJqfmp99arntrMvfkTPrm7Pzesn9mByiSXYU65c
```
If we run that a second time, you'll see the username hash is the same, but the password is diffirent (due to a diffirent salt)!
```
Mathiss-iMac:goHashingExample mathis$ go run main.go
Type username: mathis
Type password: test123
Hashed username: c413eb8a7c9415f5f8ab446ee87b55f6d636d63c1af34c861949d6a300b8f6c7
Hashed password: 4982f30b1e5ea11a977dde2f51e21a686a8058572856c47c9347f5a8021174f3
Hashing salt: 1kjBCLvctOMDE8QvWZ4PYsMfP822IVnWqAqHLcH2DUhYJbw3zJWnUEL35WwzFClh
```