File: Camellia.hs

package info (click to toggle)
haskell-cipher-camellia 0.0.2-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80 kB
  • sloc: haskell: 297; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 817 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- |
-- Module      : Crypto.Cipher.Camellia
-- License     : BSD-style
-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
-- Stability   : experimental
-- Portability : Good
--
-- Camellia support. only 128 bit variant available for now.

module Crypto.Cipher.Camellia
    ( Camellia128
    ) where

import Crypto.Cipher.Camellia.Primitive
import Crypto.Cipher.Types
import Data.Byteable

-- | Camellia block cipher with 128 bit key
newtype Camellia128 = Camellia128 Camellia

instance Cipher Camellia128 where
    cipherName    _ = "Camellia128"
    cipherKeySize _ = KeySizeFixed 16
    cipherInit k    = either error Camellia128 $ initCamellia $ toBytes k

instance BlockCipher Camellia128 where
    blockSize _ = 16
    ecbEncrypt (Camellia128 key) = encrypt key
    ecbDecrypt (Camellia128 key) = decrypt key