crypto-enigma 0.0.1.3 → 0.0.1.4
raw patch · 5 files changed
+75/−17 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +16/−0
- Crypto/Enigma.hs +8/−12
- Crypto/Enigma/Display.hs +1/−1
- README.md +32/−0
- crypto-enigma.cabal +18/−4
+ CHANGELOG.md view
@@ -0,0 +1,16 @@+See also: [code milestones](https://github.com/orome/crypto-enigma/milestones?state=closed).++### 0.0.1.4++* Some minor spelling corrections and notes.+* Added Documentation.+* Added README.+* Added CHANGELOG.+* Support for [build checks](https://travis-ci.org/orome/crypto-enigma).+++### 0.0.1.3++Initial Hackage version. First upload of package to Hackage, +without ([successful](https://hackage.haskell.org/package/crypto-enigma-0.0.1.3/reports/1)) Hacakge-built documentation.+Stable enough for use, but not reviewed.
Crypto/Enigma.hs view
@@ -49,6 +49,7 @@ import Control.Arrow import Control.Exception (assert)+import Control.Applicative import Data.Monoid import Data.List import Data.List.Split (splitOn)@@ -69,12 +70,11 @@ -- TBD - Use modular arithmetic package - http://hackage.haskell.org/package/modular-arithmetic -- TBD - Use Arrow more? -- TBD - EnigmaMachine as Monad instance?--- TBD - SPELLCHECK <<<--- TBD - Remove or properly handle Main and Test <<< -- TBD - Proper testing script - <http://dev.stephendiehl.com/hask/#testing> <<<--- TBD - Place under source control <<<+-- TBD - Make GitHub README - https://github.com/orome/crypto-enigma/issues/1+-- TBD - Get Hackage documentation working - https://github.com/orome/crypto-enigma/issues/2+-- TBD - Script for Hackage uploads -- TBD - Code review <<<--- TBD - Upload to Hackage <<< -- REV - Move plugboard last (it's 'optional'?)? -- TBD - Note how this implementation differs by preserving all letters and full mappings so they can be examined. <<< -- TBD - Use 'length.nub $ take n $ (iterate step cfg)' for all combinations of rotors to show num of unique states for all combinations of rotors (or numbers of rotor turnovers).@@ -249,11 +249,7 @@ -- >>> take 5 $ map positions $ iterate step cfg -- [[1,15,23,8,10,1],[1,16,23,8,10,1],[1,17,23,8,10,1],[1,18,23,8,10,1],[1,19,23,8,10,1]] step :: EnigmaConfig -> EnigmaConfig-step ec = EnigmaConfig {- components = components ec,- positions = steppedPosition <$> stages ec, -- Stepping changes only the rotor positions- rings = rings ec- }+step ec = ec { positions = steppedPosition <$> stages ec } -- only positions change when stepped where -- explicit factoring to expose stepping logic steppedPosition :: Stage -> Position@@ -361,7 +357,7 @@ -- | The direction that a signal flows through a 'Component'. During encoding of a character, the signal -- passes first through every component in a forward ('Fwd') direction, then through the reflector, and then, in -- revers order, through each component again, in reverse ('Rev').--- This direction affects the encoding preformed by the component (see 'componentMapping').+-- This direction affects the encoding performed by the component (see 'componentMapping'). data Direction = Fwd | Rev -- REV - Add assertion to make sure plugboard is not rotated ; assert not in keys?@@ -450,7 +446,7 @@ enigmaMappingList :: EnigmaConfig -> [Mapping] enigmaMappingList ec = scanl1 (flip encode') (stageMappingList ec) --- | The 'Mapping' preformed by the Enigma machine.+-- | The 'Mapping' performed by the Enigma machine. -- -- >>> enigmaMapping (configEnigma "b-γ-V-VIII-II" "LFAQ" "UX.MO.KZ.AY.EF.PL" "03.17.04.11") -- "CMAWFEKLNVGHBIUYTXZQOJDRPS"@@ -480,7 +476,7 @@ -- -- prop> enigmaEncoding cfg (enigmaEncoding cfg msg) == msg enigmaEncoding :: EnigmaConfig -> Message -> String-enigmaEncoding ec msg = assert (and $ (`elem` letters) <$> msg) $+enigmaEncoding ec msg = assert (all (`elem` letters) msg) $ -- The encoding of a string is the sequence encodings performed by sequentially -- stepped configurations (preceded by a step) zipWith encode (enigmaMapping <$> (iterate step (step ec))) msg
Crypto/Enigma/Display.hs view
@@ -21,6 +21,7 @@ showEnigmaEncoding ) where +import Control.Applicative import Data.Monoid import Data.Char import Data.List@@ -36,7 +37,6 @@ {-# ANN module ("HLint: error Redundant $"::String) #-} {-# ANN module ("HLint: ignore Use ."::String) #-} --- TBD - SPELLCHECK <<< -- TBD - Fix name of more detaild display -> ..EnigmConfigSchematic ? <<< -- REV - Final newline in show... functions is a bit inconsistent
+ README.md view
@@ -0,0 +1,32 @@+### crypto-enigma+++[](https://hackage.haskell.org/package/crypto-enigma)+++[](https://travis-ci.org/orome/crypto-enigma)++<!---+[](https://hackage.haskell.org/package/crypto-enigma)++--->++An Enigma machine simulator with state and encoding display.++This is adapted, as an exerecise in learning Haskell, from an earlier learning project written in Mathematica.+It is my first Haskell program.++See also:++* [enigma-hs](https://github.com/kc1212/enigma-hs)+* [crypto-classical](https://github.com/fosskers/crypto-classical)++---++### Development status++[](https://travis-ci.org/orome/crypto-enigma)++I'm currently experimenting with some Haskell language features and can't promise +[the development version](https://github.com/orome/crypto-enigma/tree/develop) +will work.
crypto-enigma.cabal view
@@ -3,19 +3,21 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.0.1.3+version: 0.0.1.4 synopsis: An Enigma machine simulator with display. description: The crypto-enigma package is an Enigma machine simulator with rich display and machine state details. . For basic functionality, including some introspection of machine state- and the mappings proformed, simply+ and the mappings performed, simply . > > import Crypto.Enigma . For richer display functionality additionally . > > import Crypto.Enigma.Display+homepage: https://github.com/orome/crypto-enigma+bug-reports: https://github.com/orome/crypto-enigma/issues license: BSD3 license-file: LICENSE author: Roy Levien@@ -23,8 +25,20 @@ -- copyright: category: Cryptography, Education build-type: Simple--- extra-source-files: -cabal-version: >= 1.22.1.1+extra-source-files: CHANGELOG.md+ README.md+cabal-version: >= 1.22++source-repository head+ type: git+ location: git://github.com/orome/crypto-enigma.git+ branch: develop++source-repository this+ type: git+ location: git://github.com/orome/crypto-enigma.git+ branch: hackage+ tag: dist002 library -- default-extensions: Trustworthy