Debian Codegraph @

Codec/Encryption/OpenPGP/ASCIIArmor/Utils.hs

raw
1 -- ASCIIArmor/Utils.hs: OpenPGP (RFC4880) ASCII armor implementation
2 -- Copyright © 2012 Clint Adams
3 -- This software is released under the terms of the Expat license.
4 -- (See the LICENSE file).
5
6 module Codec.Encryption.OpenPGP.ASCIIArmor.Utils (
7 crlfUnlines
8 , crlfUnlinesLazy
9 ) where
10
11 import Data.ByteString (ByteString)
12 import qualified Data.ByteString as B
13 import qualified Data.ByteString.Char8 as BC8
14 import qualified Data.ByteString.Lazy as BL
15 import qualified Data.ByteString.Lazy.Char8 as BLC8
16 import Data.List (intersperse)
17
18 crlfUnlines :: [ByteString] -> ByteString
19 crlfUnlines [] = B.empty
20 crlfUnlines ss = B.concat $ intersperse (BC8.pack "\r\n") ss
21
22 crlfUnlinesLazy :: [BL.ByteString] -> BL.ByteString
23 crlfUnlinesLazy [] = BL.empty
24 crlfUnlinesLazy ss = BL.concat $ intersperse (BLC8.pack "\r\n") ss