<commit_before>{-# LANGUAGE ForeignFunctionInterface #-}
-- |
-- Module      : Crypto.Cipher.RC4
-- License     : BSD-style
-- Maintainer  : <NAME> <<EMAIL>>
-- Stability   : stable
-- Portability : Good
--
-- Simple implementation of the RC4 stream cipher.
-- http://en.wikipedia.org/wiki/RC4
--
-- Initial FFI implementation by Peter White <<EMAIL>>
--
-- Reorganized and simplified to have an opaque context.
--
module Crypto.Cipher.RC4
    ( initialize
    , combine
    , generate
    , State
    ) where

import Data.Word
import Data.Byteable
import Data.SecureMem
import Foreign.Ptr
import Foreign.ForeignPtr
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Internal as B

----------------------------------------------------------------------
import Crypto.Internal.Compat

-- | The encryption state for RC4
newtype State = State SecureMem

-- | C Call for initializing the encryptor
foreign import ccall unsafe "cryptonite_rc4.h cryptonite_rc4_init"
    c_rc4_init :: Ptr Word8 -- ^ The rc4 key
               -> Word32    -- ^ The key length
               -> Ptr State -- ^ The context
               -> IO ()
<commit_msg>remove unnecessary separator<commit_after>{-# LANGUAGE ForeignFunctionInterface #-}
-- |
-- Module      : Crypto.Cipher.RC4
-- License     : BSD-style
-- Maintainer  : <NAME> <<EMAIL>>
-- Stability   : stable
-- Portability : Good
--
-- Simple implementation of the RC4 stream cipher.
-- http://en.wikipedia.org/wiki/RC4
--
-- Initial FFI implementation by <NAME> <<EMAIL>>
--
-- Reorganized and simplified to have an opaque context.
--
module Crypto.Cipher.RC4
    ( initialize
    , combine
    , generate
    , State
    ) where

import Data.Word
import Data.Byteable
import Data.SecureMem
import Foreign.Ptr
import Foreign.ForeignPtr
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Internal as B

import Crypto.Internal.Compat

-- | The encryption state for RC4
newtype State = State SecureMem

-- | C Call for initializing the encryptor
foreign import ccall unsafe "cryptonite_rc4.h cryptonite_rc4_init"
    c_rc4_init :: Ptr Word8 -- ^ The rc4 key
               -> Word32    -- ^ The key length
               -> Ptr State -- ^ The context
               -> IO ()

{'fraction_non_alphanumeric': 0.12925463162429987, 'fraction_numerical': 0.01034037052994399, 'mean_word_length': 2.4197349042709866, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2183137', 'n_tokens_mistral': 681, 'n_tokens_neox': 661, 'n_words': 211}