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

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