diff options
-rw-r--r-- | challenge/c12.go | 8 | ||||
-rw-r--r-- | challenge/c14.go | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/challenge/c12.go b/challenge/c12.go index 8c25fb2..a19777b 100644 --- a/challenge/c12.go +++ b/challenge/c12.go @@ -17,7 +17,7 @@ func C12() { blocksize := findBlockSize() nbl, us_sz := findUnknownStringCharacteristics(blocksize) - in := freshSheepBlock(blocksize) + in := freshSheepBytes(blocksize) ds := make([]byte, 0) // deciphered unknown string in bytes for i := 0; i < nbl; i++ { nby := blocksize @@ -35,9 +35,9 @@ func C12() { fmt.Printf("Unknown String:\n%v", lib.BytesToStr(ds)) } -func freshSheepBlock(blocksize int) []byte { - in := make([]byte, blocksize) - for i := 0; i < blocksize; i++ { +func freshSheepBytes(n int) []byte { + in := make([]byte, n) + for i := 0; i < n; i++ { in[i] = sheep } return in diff --git a/challenge/c14.go b/challenge/c14.go index 9ed4e5f..fe9a99e 100644 --- a/challenge/c14.go +++ b/challenge/c14.go @@ -13,8 +13,8 @@ func C14() { rpl, nrpb, rpo := findRandPrefixLen(blocksize) nbl, us_sz := findUnknownStringNumBlocksLength( rpl, blocksize) - in := append(freshSheepBlock(rpo), // random prefix offset - freshSheepBlock(blocksize)...) + in := append(freshSheepBytes(rpo), // random prefix offset + freshSheepBytes(blocksize)...) ds := make([]byte, 0) // deciphered unknown string in bytes for i := 0; i < nbl; i++ { nby := blocksize @@ -27,7 +27,7 @@ func C14() { } s := 16 * i e := s + 16 - in = append(freshSheepBlock(rpo), ds[s:e]...) + in = append(freshSheepBytes(rpo), ds[s:e]...) } fmt.Printf("Unknown String:\n%v", lib.BytesToStr(ds)) } @@ -49,7 +49,7 @@ func findBlockSizeForVarEncryptECB() int { func findRandPrefixLen(blocksize int) (int, int, int) { // Make two sheep blocks. - tsb := append(freshSheepBlock(blocksize), freshSheepBlock(blocksize)...) + tsb := append(freshSheepBytes(blocksize), freshSheepBytes(blocksize)...) v := []byte{} index := 0 |