Underc0de

Programación General => Otros lenguajes => Mensaje iniciado por: Sanko en Febrero 26, 2014, 02:28:29 PM

Título: Cifrado Vigenere - Haskell
Publicado por: Sanko en Febrero 26, 2014, 02:28:29 PM
Código (haskell) [Seleccionar]
module Vigenere where
import Data.Char

xEnc :: String -> Int -> String
xEnc xs ys = [chr ((fst(x) + snd(x)) `mod` 256)| x <- zip [ord x | x <- xs] [ord y | y <- ys]]

xDec :: String -> Int -> String
xDec xs ys = [chr ((fst(x) - snd(x)) `mod` 256)| x <- zip [ord x | x <- xs] [ord y | y <- ys]]