mirror of
https://github.com/number571/go-peer.git
synced 2026-09-12 11:40:01 +05:00
update
This commit is contained in:
parent
f7d9cae09d
commit
3a034aa361
@ -8,7 +8,7 @@ If a problem is found and such a problem becomes critical, a new version of the
|
||||
|
||||
Most of the project updates are related to patch versions. The minor version, in turn, is updated solely based on considerations of stability of all functions during manual testing. Thus, patch versions are directly related to fixing problems and creating new functionality, while minor versions are related to standardizing everything created in patch versions.
|
||||
|
||||
You can find out more about all the changes made during the correction or update of the project in the file CHANGELOG.md.
|
||||
You can find out more about all the changes made during the correction or update of the project in the file [CHANGELOG.md](https://github.com/number571/go-peer/blob/master/CHANGELOG.md).
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
||||
|
||||
```bash
|
||||
usage:
|
||||
./main [service-name] [login]
|
||||
./main -salt=[service-name] -work=[diff-size]
|
||||
stdin:
|
||||
[master-key]EOL
|
||||
```
|
||||
@ -14,12 +14,12 @@ EOL - End of Line (Enter)
|
||||
## Example
|
||||
|
||||
```bash
|
||||
$ go run . service-name login
|
||||
> master-key
|
||||
62ZD5+xzT+eQkqFjNJqLryOsLSxSUzfCMEHlt6Y4dEo=
|
||||
$ go run . -salt="service-name" -work=24
|
||||
master-key
|
||||
EvCqIyPVq9ydjspox6GqN63ggT0xrUfNFnFgwAy1odQ=
|
||||
```
|
||||
|
||||
```bash
|
||||
$ echo "master-key" | go run . service-name login
|
||||
> 62ZD5+xzT+eQkqFjNJqLryOsLSxSUzfCMEHlt6Y4dEo=
|
||||
$ echo "master-key" | go run . -salt="service-name" -work=24
|
||||
EvCqIyPVq9ydjspox6GqN63ggT0xrUfNFnFgwAy1odQ=
|
||||
```
|
||||
|
||||
@ -3,40 +3,25 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/base64"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/number571/go-peer/pkg/crypto/hashing"
|
||||
"github.com/number571/go-peer/pkg/crypto/keybuilder"
|
||||
)
|
||||
|
||||
const (
|
||||
cWorkSize = 22
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) != 3 {
|
||||
panic(fmt.Sprintf(
|
||||
"usage:\n\t%s\nstdin:\n\t%s\n\n",
|
||||
"./main [service] [login]",
|
||||
"[master-key]EOF",
|
||||
))
|
||||
}
|
||||
saltParam := flag.String("salt", "_salt_", "default salt value")
|
||||
workParam := flag.Uint("work", 24, "default work value")
|
||||
flag.Parse()
|
||||
|
||||
var (
|
||||
service = []byte(os.Args[1])
|
||||
login = []byte(os.Args[2])
|
||||
)
|
||||
keyBuilder := keybuilder.NewKeyBuilder(1<<(*workParam), []byte(*saltParam))
|
||||
gotPassword := keyBuilder.Build(readUntilEOL())
|
||||
|
||||
keyBuilder := keybuilder.NewKeyBuilder(1<<cWorkSize, login)
|
||||
extendedKey := keyBuilder.Build(readUntilEOF("> "))
|
||||
|
||||
passBytes := hashing.NewHMACSHA256Hasher(extendedKey, service).ToBytes()
|
||||
fmt.Println(base64.StdEncoding.EncodeToString(passBytes))
|
||||
fmt.Println(base64.URLEncoding.EncodeToString(gotPassword))
|
||||
}
|
||||
|
||||
func readUntilEOF(prefix string) string {
|
||||
fmt.Print(prefix)
|
||||
func readUntilEOL() string {
|
||||
res, _, err := bufio.NewReader(os.Stdin).ReadLine()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@ -187,7 +187,7 @@ func (p *sNode) GetConnections() map[string]conn.IConn {
|
||||
p.fMutex.RLock()
|
||||
defer p.fMutex.RUnlock()
|
||||
|
||||
var mapping = make(map[string]conn.IConn, len(p.fConnections))
|
||||
mapping := make(map[string]conn.IConn, len(p.fConnections))
|
||||
for addr, conn := range p.fConnections {
|
||||
mapping[addr] = conn
|
||||
}
|
||||
|
||||
12988
test/result/coverage.out
12988
test/result/coverage.out
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user