mirror of
https://github.com/Egida/EndGame0.git
synced 2025-08-07 13:52:20 -04:00
EndGame v3
This commit is contained in:
commit
9e36ba54ee
646 changed files with 271674 additions and 0 deletions
22
sourcecode/gobalance/pkg/onionbalance/tor_ed25519.go
Normal file
22
sourcecode/gobalance/pkg/onionbalance/tor_ed25519.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package onionbalance
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/ed25519"
|
||||
)
|
||||
|
||||
// LoadTorKeyFromDisk load a private identity key from little-t-tor.
|
||||
func LoadTorKeyFromDisk(keyBytes []byte) ed25519.PrivateKey {
|
||||
if !bytes.Equal(keyBytes[:29], []byte("== ed25519v1-secret: type0 ==")) {
|
||||
panic("Tor key does not start with Tor header")
|
||||
}
|
||||
expandedSk := keyBytes[32:]
|
||||
|
||||
// The rest should be 64 bytes (a,h):
|
||||
// 32 bytes for secret scalar 'a'
|
||||
// 32 bytes for PRF key 'h'
|
||||
if len(expandedSk) != 64 {
|
||||
panic("Tor private key has the wrong length")
|
||||
}
|
||||
return expandedSk
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue