summaryrefslogtreecommitdiffstats
path: root/challenge
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2022-01-21 19:30:26 -0500
committersiddharth <s@ricketyspace.net>2022-01-21 19:31:43 -0500
commit0325ffc0afb5798e1242f6c7da3c0f34d87dcb38 (patch)
treeded6c248359ab1ae03a24c645b1750ff3b9e1911 /challenge
parent889516bb504a7eb7172b1382566110e29bdbd15b (diff)
challenge: update challenge 34v0.34.0
Use sha1 of the session key as the key for encryption/decryption instead of the session key itself.
Diffstat (limited to 'challenge')
-rw-r--r--challenge/c34.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/challenge/c34.go b/challenge/c34.go
index 86a40b8..130c437 100644
--- a/challenge/c34.go
+++ b/challenge/c34.go
@@ -63,7 +63,10 @@ func C34(args []string) {
// Encipher using AES-CBC.
encipher := func(skey *big.Int, msg string) (string, error) {
// Make key out of DH sesssion key.
- skeyb := skey.Bytes()
+ sha1 := lib.Sha1{}
+ sha1.Init([]uint32{})
+ sha1.Message(skey.Bytes())
+ skeyb := sha1.Hash()
if len(skeyb) < 16 {
// Pad it to 16 bytes.
skeyb = append(skeyb, make([]byte, 16-len(skeyb))...)
@@ -89,7 +92,10 @@ func C34(args []string) {
// Decipher using AES-CBC.
decipher := func(skey *big.Int, packet string) (string, error) {
// Make key out of DH sesssion key.
- skeyb := skey.Bytes()
+ sha1 := lib.Sha1{}
+ sha1.Init([]uint32{})
+ sha1.Message(skey.Bytes())
+ skeyb := sha1.Hash()
if len(skeyb) < 16 {
// Pad it to 16 bytes.
skeyb = append(skeyb, make([]byte, 16-len(skeyb))...)