diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/ByteUtils.scala (renamed from src/ByteUtils.scala) | 2 | ||||
-rw-r--r-- | src/utils/ConversionUtils.scala (renamed from src/ConversionUtils.scala) | 8 | ||||
-rw-r--r-- | src/utils/external/Base64.scala (renamed from src/Base64.scala) | 0 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/ByteUtils.scala b/src/utils/ByteUtils.scala index 3b6046c..344f6f7 100644 --- a/src/ByteUtils.scala +++ b/src/utils/ByteUtils.scala @@ -1,4 +1,4 @@ -package main.utils +package ixee.cryptopals.utils object ByteUtils { trait SizedNumeric[T] { diff --git a/src/ConversionUtils.scala b/src/utils/ConversionUtils.scala index 5d01429..26f2d24 100644 --- a/src/ConversionUtils.scala +++ b/src/utils/ConversionUtils.scala @@ -1,9 +1,9 @@ -package main.utils +package ixee.cryptopals.utils import ByteUtils.WithBitOpts object ConversionUtils { - def hexStr2ByteArr(s: String): Iterator[Byte] = + def hexStr2Bytes(s: String): Iterator[Byte] = padToByte(s).grouped(2).map(byteStr2Byte) def byteStr2Byte(str: String): Byte = @@ -16,7 +16,7 @@ object ConversionUtils { ((a @<< 4) @+ b) def padToByte(s: String): String = - if (s.length % 2 != 0) s + "0" else s + if (s.length % 2 != 0) "0" + s else s def octet2nibble(c: Char): Byte = { (c.toLower match { @@ -32,7 +32,7 @@ object ConversionUtils { def hexStr2Base64String(s: String): String = { import io.github.marklister.base64.Base64._ - hexStr2ByteArr(s).toArray.toBase64 + hexStr2Bytes(s).toArray.toBase64 } } diff --git a/src/Base64.scala b/src/utils/external/Base64.scala index 692abb8..692abb8 100644 --- a/src/Base64.scala +++ b/src/utils/external/Base64.scala |