12 Commits

Author SHA1 Message Date
Maximilian
8114d2a6c9 Remove .exe file extension, it false flags on Windows 10 antivirus 2022-10-21 10:05:31 -05:00
Maximilian
7b36f39de6 Update gitignore to allow for .exe and show Windows binary with updated file extension 2022-10-21 10:01:11 -05:00
Maximilian
564da340d5 Include .exe extension for Windows, this is required for the binary to be recognized 2022-10-21 09:58:04 -05:00
Max
9e3549f57d Merge remote-tracking branch 'origin/master' 2022-10-09 16:17:54 -05:00
max
e72f27f80c Update 'README.md' 2022-10-09 21:17:41 +00:00
Max
1bc20536b5 Update to V1.1 and compile with Go 1.19 2022-10-09 16:15:45 -05:00
Max
03b6ac8375 Update to securely seed math/rand V1.1 2022-10-09 15:57:01 -05:00
Max
388d56b697 Switch to the latest Go version 2022-10-09 15:28:28 -05:00
Max
0c3198536f Update gitignore 2022-10-09 15:28:04 -05:00
max
b1ddefb847 Fix osx binary name 2022-08-12 16:07:52 -05:00
max
bbfcf4d5f0 Release Version 1.0 binaries 2022-08-02 18:08:57 -05:00
max
4dd661572b Fixed package name 2022-08-02 18:07:28 -05:00
7 changed files with 17 additions and 7 deletions

1
.gitignore vendored

@@ -21,3 +21,4 @@
# Go workspace file # Go workspace file
go.work go.work
/.idea/

@@ -1,5 +1,5 @@
# GoPass # GoPass
An easy to use command-line password generator that creates secure passwords An easy to use command-line password generator that creates secure passwords (Version 1.1 adds proper cryptographic seeding of math/rand)
# Usage: # Usage:
<code>./gopass [number of characters]</code><br> <code>./gopass [number of characters]</code><br>

BIN
bin/gopass-amd64-linux Executable file

Binary file not shown.

BIN
bin/gopass-amd64-osx Executable file

Binary file not shown.

BIN
bin/gopass-amd64-windows Normal file

Binary file not shown.

2
go.mod

@@ -1,3 +1,3 @@
module GoPass module GoPass
go 1.18 go 1.19

19
main.go

@@ -1,11 +1,15 @@
package GoPass // GoPass
// Author: Maximilian Patterson
// Version: 1.1
package main
import ( import (
cryptorand "crypto/rand"
"encoding/binary"
"fmt" "fmt"
"math/rand" mathrand "math/rand"
"os" "os"
"strconv" "strconv"
"time"
) )
var runes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_+[]\\{}|;':,./<>?") var runes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_+[]\\{}|;':,./<>?")
@@ -24,11 +28,16 @@ func main() {
pass := make([]rune, size) pass := make([]rune, size)
// Seed rand with time // Seed rand with time
rand.Seed(time.Now().UTC().UnixNano()) var b [8]byte
_, err = cryptorand.Read(b[:])
if err != nil {
panic("Error securely seeding rand!")
}
mathrand.Seed(int64(binary.LittleEndian.Uint64(b[:])))
// Assign every slot of pass to a random rune (generate rand int of length runes to select) // Assign every slot of pass to a random rune (generate rand int of length runes to select)
for i := range pass { for i := range pass {
pass[i] = runes[rand.Intn(len(runes))] pass[i] = runes[mathrand.Intn(len(runes))]
} }
// Print the pass :D // Print the pass :D