EndGame v3

This commit is contained in:
Aksh 2024-10-23 20:50:14 +05:30
commit 9e36ba54ee
646 changed files with 271674 additions and 0 deletions

View 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
}