Ограничил список доступных функций

This commit is contained in:
2024-11-19 14:37:33 +03:00
parent 19b8202fa8
commit 0faffa20ce

View File

@@ -1,12 +1,14 @@
module Lib
-- (
-- createAlphabetFromText,
-- encryptCaesar,
-- decryptCaesar,
-- textToBits,
-- bitsToText,
-- encodePixel
-- )
(
createAlphabetFromText,
encryptCaesar,
decryptCaesar,
textToBits,
bitsToText,
encodePixel,
extractShift,
extractBitsFromImage
)
where
import Codec.Picture
@@ -48,8 +50,8 @@ textToBits text = VU.fromList $ concatMap charToBits text
charToBits :: Char -> [Int]
charToBits c = [if testBit (ord c) i then 1 else 0 | i <- [7,6..0]]
intToBits :: Int -> [Int]
intToBits n = [if testBit n i then 1 else 0 | i <- [31,30..0]]
-- intToBits :: Int -> [Int]
-- intToBits n = [if testBit n i then 1 else 0 | i <- [31,30..0]]
bitsToText :: VU.Vector Int -> String
bitsToText bits
@@ -62,12 +64,6 @@ bitsToInt bits =
where
len = VU.length bits - 1
setLastBits :: VU.Vector Int -> VU.Vector Int -> VU.Vector Int
setLastBits byte newBits = byte VU.// updates
where
newBitsLastIndex = VU.length newBits - 1
updates = [(7 - i, newBits VU.! (newBitsLastIndex - i)) | i <- [0..newBitsLastIndex]]
intToWord8 :: Int -> Word8
intToWord8 x = fromIntegral x