sophuwu.site > seks
intermediate
sophuwu sophie@skisiel.com
Thu, 11 Apr 2024 20:16:15 +0200
commit

41b4c582b1739d6adc3841f532fc66972d0327cb

parent

25fbe76a30e894b8a192d5f598bfce4e4b68e1b0

3 files changed, 16 insertions(+), 16 deletions(-)

jump to
M go.modgo.mod

@@ -1,10 +1,10 @@

-module seks +module sophuwu.site/seks.git go 1.21.3 -require golang.org/x/crypto v0.14.0 - require ( - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect + golang.org/x/crypto v0.14.0 + golang.org/x/term v0.13.0 ) + +require golang.org/x/sys v0.13.0 // indirect
M main.gomain.go

@@ -1,7 +1,7 @@

/* * SEKS: Some Encryption Key Stuff */ -package main +package seks import ( "bytes"

@@ -11,7 +11,6 @@ "fmt"

"golang.org/x/crypto/nacl/secretbox" "golang.org/x/term" "os" - "seks/sopHex" "syscall" )
M sopHex/sopHex.goencoding/encoding.go

@@ -1,27 +1,28 @@

-package sopHex +package encoding import ( "fmt" "strings" ) -const sopHexSet string = "SOPHIE+MAL1VN=<3" +// var SEKSSet string = `SOPHIE+MAL1VN=<3` // short for test purposes +var SEKSSet string = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$£` -const seksHeader string = "-----BEGIN SEKS SECRET-----" -const seksFooter string = "-----END SEKS SECRET-----" +const seksHeader string = "-----BEGIN SOME ENCRYPTION KEY STUFF-----" +const seksFooter string = "-----END SOME ENCRYPTION KEY STUFF-----" -func Marshall(b []byte) string { +func Armour(b []byte) string { var s string for i := 0; i < len(b); i++ { - if i%16 == 0 { + if i%69 == 0 { s += "\n" } - s += string(sopHexSet[(b[i]>>4)&15]) + string(sopHexSet[b[i]&15]) + s += string(SEKSSet[(b[i]>>4)&15]) + string(SEKSSet[b[i]&15]) } return seksHeader + s + "\n" + seksFooter + "\n" } -func UnMarshall(s string) ([]byte, error) { +func UnArmour(s string) ([]byte, error) { begin := strings.Index(s, seksHeader) end := strings.Index(s, seksFooter) if begin < 0 || end < 0 {

@@ -50,7 +51,7 @@ return b, nil

} func index(c rune) (j int) { - for j, v := range sopHexSet { + for j, v := range SEKSSet { if v == c { return j }