From 78ff3c607a6b7252c872ee6393c504d87c371489 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Tue, 20 Oct 2026 16:10:18 -0700 Subject: Remove a lot of files that aren't necessary --- .gitignore | 3 -- assets/angry.png | Bin 3905042 -> 0 bytes assets/angry.xcf | Bin 153335 -> 0 bytes go.mod | 3 -- go.sum | 4 --- internal/pwhash/pwhash.go | 36 ------------------------ roseh.moe_test.go | 18 ------------ static/angry.webp | Bin 15356 -> 0 bytes static/fart.mp3 | Bin 12356 -> 0 bytes tools/auth/auth.go | 68 --------------------------------------------- tools/finditer/finditer.go | 60 --------------------------------------- tools/hashpw/hashpw.go | 53 ----------------------------------- 12 files changed, 245 deletions(-) delete mode 100644 assets/angry.png delete mode 100644 assets/angry.xcf delete mode 100644 internal/pwhash/pwhash.go delete mode 100644 roseh.moe_test.go delete mode 100644 static/angry.webp delete mode 100644 static/fart.mp3 delete mode 100644 tools/auth/auth.go delete mode 100644 tools/finditer/finditer.go delete mode 100644 tools/hashpw/hashpw.go diff --git a/.gitignore b/.gitignore index 3ed378c..ffff036 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ /roseh.moe -/auth -/finditer -/hashpw /result /secrets.xml /config.xml diff --git a/assets/angry.png b/assets/angry.png deleted file mode 100644 index 68ff462..0000000 Binary files a/assets/angry.png and /dev/null differ diff --git a/assets/angry.xcf b/assets/angry.xcf deleted file mode 100644 index 7a163f7..0000000 Binary files a/assets/angry.xcf and /dev/null differ diff --git a/go.mod b/go.mod index 6b9af98..033c5b1 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,6 @@ go 1.26.0 require ( github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e - golang.org/x/term v0.47.0 roseh.moe/pkg/oae2 v0.3.1 roseh.moe/pkg/wordlist v1.0.2 ) - -require golang.org/x/sys v0.49.0 // indirect diff --git a/go.sum b/go.sum index c6dfe9f..d221e92 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,5 @@ github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= -golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= -golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= -golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= roseh.moe/pkg/oae2 v0.3.1 h1:HW6GxhntwDSSBup87mDlWRUNaAhkrlJ0x+F3ncnmlbQ= roseh.moe/pkg/oae2 v0.3.1/go.mod h1:SZ5K2nvKreVdhHVNxujxcZLOnjhVi+qPi2XkB18dR8g= roseh.moe/pkg/wordlist v1.0.2 h1:riB2RqCU5zXfCQjaPHYTXV/688FV9/Bp6Hnb0IAkP9c= diff --git a/internal/pwhash/pwhash.go b/internal/pwhash/pwhash.go deleted file mode 100644 index 5a2082d..0000000 --- a/internal/pwhash/pwhash.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2026 Rose Hogenson -// -// This file is part of roseh.moe. -// -// roseh.moe is free software: you can redistribute it and/or modify it -// under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, -// or (at your option) any later version. -// -// roseh.moe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public -// License along with roseh.moe. If not, -// see . - -package pwhash - -import ( - "crypto/pbkdf2" - "crypto/sha512" -) - -const SaltSize = 8 - -const defaultIter = 12175430 // from tools/finditer - -func HashIter(password string, salt []byte, iter int) ([]byte, error) { - return pbkdf2.Key(sha512.New, password, salt, iter, 32) -} - -func Hash(password string, salt []byte) ([]byte, error) { - return HashIter(password, salt, defaultIter) -} diff --git a/roseh.moe_test.go b/roseh.moe_test.go deleted file mode 100644 index cf41cd0..0000000 --- a/roseh.moe_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import ( - "testing" - "time" -) - -func TestMarshalTime(t *testing.T) { - now := time.Now().Truncate(time.Second) - b := marshalTime(now) - got, ok := unmarshalTime(b) - if !ok { - t.Fatalf("Failed round trip") - } - if !got.Equal(now) { - t.Errorf("Failed round trip. unmarshalTime(%v) = %v, want %v", b, got, now) - } -} diff --git a/static/angry.webp b/static/angry.webp deleted file mode 100644 index 6fa91df..0000000 Binary files a/static/angry.webp and /dev/null differ diff --git a/static/fart.mp3 b/static/fart.mp3 deleted file mode 100644 index 1717d9d..0000000 Binary files a/static/fart.mp3 and /dev/null differ diff --git a/tools/auth/auth.go b/tools/auth/auth.go deleted file mode 100644 index 6268ba8..0000000 --- a/tools/auth/auth.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 Rose Hogenson -// -// This file is part of roseh.moe. -// -// roseh.moe is free software: you can redistribute it and/or modify it -// under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, -// or (at your option) any later version. -// -// roseh.moe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public -// License along with roseh.moe. If not, -// see . - -package main - -import ( - "encoding/base32" - "encoding/base64" - "encoding/xml" - "flag" - "fmt" - "os" - - "github.com/skip2/go-qrcode" -) - -func run() error { - args := flag.Args() - if len(args) != 1 { - return fmt.Errorf("usage: auth ") - } - fileBytes, err := os.ReadFile(args[0]) - if err != nil { - return err - } - var config struct { - AuthKey string `xml:",attr"` - } - if err := xml.Unmarshal(fileBytes, &config); err != nil { - return err - } - if config.AuthKey == "" { - return fmt.Errorf("%s: missing AuthKey", args[0]) - } - authKey, err := base64.StdEncoding.DecodeString(config.AuthKey) - if err != nil { - return err - } - qrCode, err := qrcode.New(fmt.Sprintf("otpauth://totp/roseh.moe:rose?secret=%s&issuer=roseh.moe", base32.StdEncoding.WithPadding(base32.NoPadding).EncodeToString(authKey)), qrcode.Medium) - if err != nil { - return err - } - fmt.Print(qrCode.ToSmallString(false)) - return nil -} - -func main() { - flag.Parse() - if err := run(); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} diff --git a/tools/finditer/finditer.go b/tools/finditer/finditer.go deleted file mode 100644 index f5bf75f..0000000 --- a/tools/finditer/finditer.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 Rose Hogenson -// -// This file is part of roseh.moe. -// -// roseh.moe is free software: you can redistribute it and/or modify it -// under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, -// or (at your option) any later version. -// -// roseh.moe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public -// License along with roseh.moe. If not, -// see . - -package main - -import ( - "encoding/hex" - "fmt" - "sort" - "testing" - "time" - - "roseh.moe/pkg/roseh.moe/internal/pwhash" -) - -func mustHex(s string) []byte { - b, err := hex.DecodeString(s) - if err != nil { - panic(err) - } - return b -} - -var salt = mustHex("34539b5dd2591415") - -var iter int - -func BenchmarkHashIter(b *testing.B) { - const password = "wavy upend 4z jk linda k zing four atop pi" - for b.Loop() { - pwhash.HashIter(password, salt, iter) - } -} - -func main() { - const targetTime = 5 * time.Second - for iter = 8192; time.Duration(testing.Benchmark(BenchmarkHashIter).NsPerOp()) < targetTime; iter *= 2 { - } - lo := iter / 2 - hi := iter - fmt.Println(lo + sort.Search(hi-lo, func(n int) bool { - iter = lo + n - return time.Duration(testing.Benchmark(BenchmarkHashIter).NsPerOp()) > targetTime - })) -} diff --git a/tools/hashpw/hashpw.go b/tools/hashpw/hashpw.go deleted file mode 100644 index 8244b64..0000000 --- a/tools/hashpw/hashpw.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2026 Rose Hogenson -// -// This file is part of roseh.moe. -// -// roseh.moe is free software: you can redistribute it and/or modify it -// under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, -// or (at your option) any later version. -// -// roseh.moe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public -// License along with roseh.moe. If not, -// see . - -package main - -import ( - "crypto/rand" - "encoding/base64" - "fmt" - "os" - - "golang.org/x/term" - "roseh.moe/pkg/roseh.moe/internal/pwhash" -) - -func hashpw() error { - fmt.Fprint(os.Stderr, "Enter password: ") - pw, err := term.ReadPassword(int(os.Stdin.Fd())) - fmt.Fprintln(os.Stderr) - if err != nil { - return err - } - salt := make([]byte, pwhash.SaltSize) - rand.Read(salt) - pwHash, err := pwhash.Hash(string(pw), salt) - if err != nil { - return err - } - fmt.Printf("NotepadPassword=\"%s\"\n", base64.StdEncoding.EncodeToString(append(salt, pwHash...))) - return nil -} - -func main() { - if err := hashpw(); err != nil { - fmt.Fprintf(os.Stderr, "hashpw: %s\n", err) - os.Exit(1) - } -} -- cgit v1.3.1