Man Cyprium


=== Howto ===


Python/Compiler/SQLite:

First of all, you need python 3.x installed on your computer.

Download first C compiler to compile Python:

sudo apt-get install build-essential

Install SQLite libs:

sudo apt-get install libsqlite3-dev
sudo apt-get install sqlite3
sudo apt-get install bzip2 libbz2-dev

Download and compile Python:

wget http://python.org/ftp/python/3.3.2/Python-3.3.2.tar.bz2
tar jxf ./Python-3.3.2.tar.bz2
cd ./Python-3.3.2
./configure --prefix=/opt/python3.3
make && sudo make install

DDL: http://www.python.org/downloads/

Cyprium:

https://github.com/underloki/Cyprium/archive/master.zip

===== About Argots =====

				Argots allows you to cypher and decypher some text using one of Argot Javanais,
				Langue de Feu (or there generic version), or Largonji des Loucherbems methods.


				== Argot Javanais, Langue de Feu and Generic ==
				The principle is to insert a syllable (always the same, two letters only,
				which we’ll call “obfuscating syllable”) between consonants and vowels
				(with a few additional restrictions/special cases).

				Javanais method allows (and searches for, at decypher time) the traditional
				'ja', 'av' and 'va' syllables, and all their case variants ('Ja', 'VA', etc.).
				E.g. using ja:
				“Les « Blousons Noirs » vous parlent…” →
					“Ljaes « Bljaousjaons Njaoirs » vjaous parljaent…”

				Feu method allows (and search for, at decypher time) all syllables made of
				a 'f' and a vowel, and all their case variants ('fe', 'Af', 'fO', 'UF', etc.).
				E.g. using Ef:
				“Les Apaches sont sur le sentier des Halles.” →
					“LEfes EfApEfachEfes sEfont sEfur lEfe sEfentEfier dEfes HEfallEfes.”

				Generic method allows (and search for, at decypher time) all syllables made of
				a consonant and a vowel, or two different vowels, and all their case variants
				(example of *not allowed* syllables: 'oO', 'ii', 'fp', 'Kz', etc.).
				E.g. using uz:
				“Casque d’or refait sa permanente.” ->
					“Cuzasquzue d’or ruzefuzait suza puzermuzanuzentuze.”

				You can also use another cypher algorithm, “exhaustive”, that will, for each
				word, check *all* possible cyphering, and output (again, for each word) all
				solutions giving a cyphering threshold (i.e. nbr of obfuscating syllables
				added/total nbr of chars) around the given one ([0.0 .. 1.0] ± 0.05) – note
				that with this tool, a cyphering of 0.3/0.4 is in general already very high,
				higher values are very seldom possible.

				WARNING: Avoid using that option with words with more than about 20 chars,
						 the compute time will quickly become prohibitive!

				E.g. for “Bellville”, with 'av' and a cyphering goal of 0.3:
					Bavelleviavllave
					Bavellavevillave
					Beavlleviavllave
					Beavllavevillave
					Bavellevavillave
					Bavellaveviavlle
					Bavellavevaville
					Bellaveviavllave
					Beavllaveviavlle
					Beavllevavillave
					Bellavevavillave
					Beavllavevaville

				WARNING: If the text already contains the obfuscating syllable, it will
						 likely be lost a decyphering time!


				== Largonji des Loucherbems ==
				WARNING: While previous methods, even though french at origin, are quite easily
						 extendable to other languages, the Louchébem is tightly related to
						 french phonetic, and hence might give strange/unusable results with
						 other languages.
						 And even with french, it’s hard to get reliable results with
						 procedural algorithms… So this tool is more an help than an
						 “out-of-the-box” solution.

				This “cyphering” roughly consists in, for each word:
					* If the first letter is a consonant, move it to the end of the word.
					* Add an 'l' at the beginning of the word.
					* Finally, add a (more or less random) syllable at the end of the word.
				So you get “boucher” (butcher) ==> “oucherb” ==> “loucherb” ==> “loucherbème”.
						   “jargon” ==> “argonj” ==> “largonj” ==> “largonji”.
						   “abricot” ==> “abricot” ==> “labricot” ==> “labricotqué”
						   “lapin” ==> “apinl” ==> “lapinl” ==> “lapinlic”.
						   etc.

				By default, the following vowels can be added after a “phonetic vowel”:
					'{}'
				And those, after a consonant:
					'{}'
				You can specify other sets, but beware, this might make decyphering even more
				complicated and unreliable…

				Note that during decyphering, if Argots finds an unknown suffix, it will try
				to use it too – but result may well be quite wrong in this case. And given
				the fuzzyness of this argots, decyphering will systematically output the
				original (cyphered) word, at the end of the lists.

				Note also that current code assume “largonji suffixes” are never longer than 5
				chars, and never (de)cyphers words shorter than 4 chars (sorry for
				“loufoque” !).

===== About AtomicDigits =====

				AtomicDigits allows you to cypher and decrypt ascii-chars only text in the
				atomic digits-code.

				“Hello world” → “2 L L 8  74 8 R L D”

				Note that the text must be uppercase, and that the non-cryptable chars will
				remain unciphered. Spaces are allowed and coded as double-spaces.

				You can also use another cypher algorithm, “exhaustive”, that will, for each
				word, check *all* possible chipering, and output (again, for each word) all
				solutions giving a cyphering threshold (i.e. nbr of cyphered chars/total nbr
				of chars) higher than the given one ([0.0 .. 1.0]).

				WARNING: Do not use this with words over about 20 chars length, compute time
						 will become prohibitive.

				E.g. for “NITROGEN”, with a threshold of 0.5 (at least half of the letters
				cyphered):
					 7 I T R 8 32 7
					 7 I T R O 32 7
					7 53 T R 8 G E 7
					7 53 T R 8 32 7
					 28 T R O 32 7
					 28 T R 8 32 7
					 28 T R 8 G E 7
					 N I T R 8 32 7
					7 53 T R O 32 7


				It can also decypher texts like “2LL8  748RLD”, printing all possible
				solutions.

===== About Baudot =====

				Baudot allows you to cypher and decypher some text using Baudot codes.

				Allowed chars are: lowercase ASCII chars, digits, newlines, and a few others
				('{}').

				You can cypher to/decypher from four bases (binary [over 5 bits], octal,
				decimal and hexadecimal).

				E.g. with “hello 2012!”:


				Note that when decyphering, most of the time, you do not need to specify the
				base, Baudot will detect it automatically.

===== About Beale =====

This cyphering is rather simple, though nearly impossible to hack without the key.

				It simply takes each letter of the text to cypher, finds a word in the key starting with the same letter, and output
				this word’s index in the key. This implies it can only cypher letters (converted to upper-ASCII chars), everything
				else is dropped/lost.

				Historically, Beale is the name of the man who invented this cyphering, see wikipedia for more details!

				E.g. with both above paragraphs as key, “Beale” could be cyphered as “49, 43, 41, 21, 44”,
				“49, 43, 12, 37, 44”, “49, 44, 22, 47, 43”, etc.

				Obviously, you have to feature a key containing all the letters (i.e. words which first letters…)
				needed by the data to cypher, and preferably several times, to get a better cyphering.

				Please note that this tool uses a pseudo-random way of choosing an index for a given letter, driven by a seed number.
				This means that you will always get the same result for the same data/key/seed triple. Change the seed and you’ll
				get a different result!

===== About Biliteral =====

				Biliteral is a cryptographic tool which can cypher text in the biliteral code,
				which is a binary encoding using A and B as digits.

				Cypher input can be any string containing ASCII lowercase letters only
				(no spaces), decypher input must be an integer number of groups of five
				(A,B) digits.

				Note that [ij] and [uv] have the same biliteral codes.

===== About Braille =====

Braille allows you to cypher and decypher text into informatic-Braille
				us-437 (on 8 dots).

				You can use all chars from the cp1252 charset (Windows 8bit encoding).

				Example : “Hello world” → “125 15 123 123 135  2456 135 1235 123 145”

				Note that the space-char is cyphered with 2 spaces.

===== About BrainFuck =====

				BrainFuck, and the similar Ook, Spoon and SegFaultProg languages, are some
				minimalist programming languages, highly unreadable by a human being – that’s
				why they can be used to cypher some textual data.

				This tool “(de)cyphers” any kind of text into one of those language, using a
				given codec to convert text to/from binary (defaults to "utf-8").

				While decyphering such code is quite straightforward (it’s just a matter of
				“executing” the given code and showing the result), cyphering is more complex.

				Indeed, you can virtually generate in infinite number of cyphering for a same
				text (limit is in fact enforced by the size of the interpreter memory,
				currently 100Ko).

				This tool uses a quite good algorithm to generate some “opcode” (an internal
				representation of SegFaultProg). This process is very little affected by
				randomness.

				Based on this opcode, it can add some obfuscating code (i.e. code not affecting
				the output data), which is this time higly affected by randomness.

				*The randomness:
					You might want to get some control over that randomness. So you have the
					option to either get a pure random solution (default behavior), get a
					reproducible random solution by giving a number as seed for the generator,
					or use the whole cyphered text as seed.

				*The level of obfuscation:
					Such generated code can be a rather compact solution (something like 10
					times the original text length for BrainFuck, for example), or thousands of
					chars for a simple word. This is the same principle as with obfuscation of
					source code. So you can specify an obfuscation level, from 0.0 (no
					obfuscation) to 1.0 (adding an average of 5 “nop” opcodes between each
					“useful” ones). Note that an opcode will translate as one intruction in
					SegFaultProg, but might generate several tens of instructions in the other
					languages…


				In addition, this tool also can convert some code between different languages.

===== About Caesar =====

				Caesar is a cryptographic tool which can cypher text in three different
				versions of Caesar’s code: Basic, Progressive and Caesar’s square.

				All accept only strict ASCII upper chars, and sometime spaces (this will be
				detailed for each algo).



				The Basic algorithm simply applies a constant offset to each char, cycling
				from Z to A: “Bonjours” with offset (key) 4 gives “FSRNSYVW”.

				This algo just output spaces unchanged, but note that having spaces make it
				even weaker than it already is…



				The Progressive algorithm applies a varying offset to each char, also cycling
				from Z to A. It has two different methods, and behaves differently when
				cyphering a single word or a whole text (with spaces between words).

				The offset can follow to different increasing schemes:
				* Geometrical progression: with a given key, offset will be key, key*2,
				  key*3, etc.
				* Shift: This a geometrical progression of 1, but initially offset by key
				  (i.e. key, key+1, key+2, etc.).

				With no-spaces texts, the offset is increased for each char, while it is only
				increased for each new word in texts containing spaces.
				*This means spacing is crucial with this algo, loosing or changing it will make
				the text undecypherable!*

				E.g.:
				* “GUTEN TAG” in geometrical mode, with key 12: “SGFQZ RYE”
				* “GUTENTAG”  in geometrical mode, with key 12: “SSDAVNGY”
				* “HOLA MUNDO” in shift method, with key 7: “OVSH UCVLW”
				* “HOLAMUNDO”  in shift method, with key 7: “OWUKXGARD”

				Note that with geometrical method, using key 13 is not a good idea, as one char
				or word over two will remain uncyphered (13*2 = 26…)!



				The Caesar’s square is more like matrix operation called “transposition”. The
				idea is to cut the input text in pieces of same length (as much as possible,
				the last one will likely be shorter…), to place them over the other, and then
				to read the columns of that table.

				E.g. “CAIVSIVLIVSCAESAR” with a width of 4 gives
					CAIV
					SIVL
					IVSC
					AESA
					R
				… hence “CSIARAIVEIVSSVLCA”

				That tool implements the three variants of this algo, Square itself (i.e. using
				a table of n*n dimension, as small as possible for the given text)
				[when key=0], constant width, and constant high (which is also known as the
				Cytale cyphering).



				This tool can also hack some cyphered text, and output most probable decyphered
				result, using per-language lists of words.
				{}

===== About Celldrawer =====

				Celldrawer cyphers/decyphers “celldrawer” code.

				This code only accepts lowercase ASCII letters, and represents them by
				phone digits (#*0123456789), so that each code “draws” its letter on a
				4×3 phone keyboard.

							2
						  4   6
						  7 8 9
				E.G.: A:  *   #
				

===== About ChineseCipher =====

				ChineseCipher allows you to cypher and decypher ASCII lowercase text
				into Chinese or Samurai (or their digit version) ciphers.

				Note that the space-char is cyphered with 2 spaces.

				For example, “the hackademy”:
					Chinese: “————||||| ——||| ——  ——||| — —|| ———|| — —||| —— ———|||| ——————”
					Samurai: “||||————— ||——— ||  ||——— | |—— |||—— | |——— || |||———— ||||||”
					Digits:  “45 23 20  23 10 12 32 10 13 20 34 60”
				

===== About CodeABC =====

				CodeABD cyphers/decyphers the phone keyboard code.

				This code only accepts lowercase ASCII letters and space, and represents
				them by phone codes like 0 for space, 111 for 'c', 5 for 'j', etc.
				

===== About Gray =====

				Gray code is another way to represent binary numbers, so that going from
				one number to the next only needs one digit switch.

				For example, “7” is “00111” in standard binary, and “00100” in Gray code,
				while “8” is “01000” in binary and “01100” in Gray. As you can see, going
				from 7 to 8 implies four digit changes with standard binary, while only
				one in Gray code.

				Historically, Gray code has been very important when binary data were still
				handled by many mechanical hardware (like switches…), as it allowed less
				usage of those switches, and a better synchronization (with mechanical
				devices, it’s quite hard to get them switching exactly at the same time).

				This tool allows you to “cypher” some text into some binary form of Gray code.

				Indeed, each word length gives a different Gray code – usual (traditional)
				words were of 3, 4 or 5 bits, but you can use any length you like…
				

===== About Morse|Wabun =====

				Morse|Wabun is a tool which can “(de)cypher” text to/from morse, or its
				japanese version, Wabun.

				The valides structures of morse code, for input and output, are:

				International: “===...=.=.=.=...=.=...=.=.=.......=.=...=.=.=”,
							   where a '.' separates each morse’s “digit”,
									 a '...' separates each letter,
									 a '.......' separates each word (i.e. a space),
									 a '=' represents a dot,
									 and a '===' represents a dash.
				Fast international: “- .... .. ... / .. ... / .- / ... --- ...”,
							   where a ' ' separates each letter,
									 a ' / ' separates each word (i.e. a space),
									 a '.' represents a dot,
									 and a '-' represents a dash.

				Wabun uses the kana japanese syllable alphabet morse code. This means that
				each morse code represents a syllable, and not a letter – hence all letters
				of a text typically cannot be cyphered, and you get something like:

				“HELLO WORLD” ==> “. L L .-... / .--- R L D”

				You can have the same variants (standard and fast representations).

				You can also use another cypher algorithm for Wabun, “exhaustive”, that will,
				for each word, check *all* possible cyphering, and output (again, for each
				word) all solutions giving a cyphering threshold (i.e. nbr of cyphered chars/
				total nbr of chars) higher than the given one ([0.0 .. 1.0]) – note that
				with this tool, a cyphering of 0.6/0.7 is in general already very high, higher
				values are very seldom possible (except with rōmaji!).

				WARNING: Avoid using that option with words with more than about 20 chars,
						 the compute time will quickly become prohibitive!

				E.g. for “KATAKANA”,with a threshold of 0.7:
					K --.-- T --.-- .-.. .-.
					 K --.-- -. .-.. N --.--
					 K --.-- -. K --.-- .-.
						.-.. -. .-.. .-.
					 .-.. -. K --.-- N --.--
					   .-.. -. K --.-- .-.
					.-.. T --.-- K --.-- .-.
					  .-.. T --.-- .-.. .-.
					  .-.. -. .-.. N --.--
					   K --.-- -. .-.. .-.
					.-.. T --.-- .-.. N --.--

				Note that both tools expect uppercase-text only. Morse accepts a few special
				chars, in addition to ASCII letters and numbers, while Wabun only accepts
				strict ASCII letters and coma, spaces and dots.

				The path of the input file can be absolute (e.g. for linux, if the input
				file is on your desktop: '/home/admin_name/Desktop/your_input_file'), or
				relative to the dir from where you started Morse.

				Obviously, the same goes for the output file.
				

===== About Octopus =====

				Octopus is a simple numbers/text converter. It allows you to cypher and
				decypher text to/from binary, octal, decimal or hexadecimal.

				It can also cut the output into bytes separated by spaces.

				You can use special characters and accents, if you specify a compatible
				encoding (e.g. default one, utf-8).

				You can also choose ASCII 7bit to get binary encoded over 7 bits instead of 8.

				Note: when decyphering, most of the time you can let Octopus auto-detect which
				base to use. However, somtimes this will fail (e.g. a decimal-cyphered text
				with no '8' nor '9' will be detected as octal…).
				

===== About PostalBarcode =====

				Postal bar code allows you to cypher and decypher a number into that bar code.

				You can use digits only.

				You can get either the original code (with pipes and dots), or the more widely
				used “classical” version (with pipes and spaces), either in straight or
				reversed order. Cyphered digits are space-separated.

				Example : “3141592654”:
				org stght:
					“⋅|||⋅| ⋅|⋅||| |⋅⋅||| ⋅|⋅||| |⋅|⋅|| |||⋅⋅| ⋅||⋅|| |⋅||⋅| |⋅|⋅|| |⋅⋅|||”
				org rev:
					“|⋅⋅||| |⋅|⋅|| |⋅||⋅| ⋅||⋅|| |||⋅⋅| |⋅|⋅|| ⋅|⋅||| |⋅⋅||| ⋅|⋅||| ⋅|||⋅|”
				cls straight:
					“ ||| |  | ||| |  |||  | ||| | | || |||  |  || || | || | | | || |  |||”
				cls rev:
					“|  ||| | | || | || |  || || |||  | | | ||  | ||| |  |||  | |||  ||| |”

				Note: Output order is always that one (original straight, original reversed,
				classical straight, classical reversed), whatever are the chosen options.

===== About Prime =====

				Prime allows you to cypher and decypher texts using prime numbers below 1000.

				Allowed chars are: strict ASCII lowercase and space.

				The cypher method takes an optional “base” (defaults to 1), which represent
				the nth prime number to be used to encode 'a':
					base 1 ==> A = 2, B = 3, C = 5, …
					base 2 ==> A = 3, B = 5, C = 7, …

				Base can be in [{}, {}].

				E.g. with “a prime pair”:
					base 1: 2  53 61 23 41 11  53 2 23 61
					base 101: 547  641 647 599 617 571  641 547 599 647
				

===== About Triliteral =====

				Triliteral is a cryptographic tool which can cypher text in the triliteral
				code, which is a base-three encoding using A, B and C as digits.

				Cypher input can be any string containing ASCII lowercase letters only
				(no spaces), decypher input must be an integer number of groups of three
				(A,B,C) digits.

				That tool also has an optional trick, called “base”: you can choose which
				letter to use as “first code”, so that, if e.g. you choose a base of 4,
				the first code (AAA) is used by 'e', AAB by 'f', etc., and cycling back to CBC
				for 'a', CCA for 'b', and so on. The default base  (AAA for 'a') being 1.
				

===== About Vigenere =====

				Vigenere is a tool that allows you to cypher a text into another one,
				using the vigenere-cypher. It also contains 3 variants:
					Autoclave: uses the plain text to make the key so much longer
				as the plain text.

					Beaufort: uses classic vigenere but process the key-letter as clear
				text and the clear-text letter as key.

					Gronsfeld: uses digits, where the classic vigenere uses letters.
				it uses a string of digits as key.

				Allowed chars are ascii-letters, digits and ascii-punctuation

				Example
					text = "AN HACKADEMY"
					key = "KEY"
					cypher(text, key, ALGO_VIGENERE)
							= "KR FKGIKHCWC"

					cypher(text, key, ALGO_BEAUFORT)
							= "KR RKCOKBUYG"

					cypher(text, key, ALGO_AUTOCLAVE)
							= "KR FAPRAFOMB"

					cyphper(text, "789", ALGO_GRONSFELD)
							= "HV QHKTHLNTG"

					An option "with_spaces" determines if spaces and punctuation should
				be store.
					cypher(text, key, ALGO_VIGENERE, with_spaces=False)
						= "KRFKGIKHCWC"
						
				decypher methods haven the same parameters.
				

===== About AlphaSpaces =====

				AlphaSpaces is a steganographic tool which simply hides a short sentence
				into the spaces of a bigger text.

				This obviously implies that the hiding text must have at least as many spaces
				as letters to hide!

				Example:
					Input text to hide data into: “This is a quite simple steganographic tool”
					Data to hide: “stegano”
					Hidden data: “This                   is                    a     """ \
								 """quite       simple steganographic              tool”

				Note: That type of steganography is mostly useful for web content, as html
				browsers never show more than one space between words, it is invisible on
				screen. But obviously, easy to see if you have a look at the raw html code!
				

===== About Sema =====

				Sema is a steganographic tool which can hide text datas in a file, by
				putting dots (or optionally, another sign) under letters.
				By this way, it allows you to hide a keychain (a word or a sentence)
				via semagrammas (dots) in a larger text file. This technique allows
				to confuse the reader who won’t see most of the dots and will believe
				that the few ones he sees are probably a bug.

				The max length of the hidden data must be 40 times less longer than the
				input text.

				Note that only strict ASCII alphanumeric chars are allowed in data to
				hide, any other char will be striped!

				Example:
				input file size = 1000 char
				max length of hidden data = 25 char

				The path of the input file can be absolute (e.g. for linux, if the input
				file is on your desktop: '/home/admin_name/Desktop/your_input_file'), or
				relative to the dir from where you started Sema.

				Obviously, the same goes for the output file.
				

===== About Spaces =====

				Spaces is a steganographic tool which simply hides a short sentence
				into the letters of a bigger text. Alowed chars in text are strict lowercase
				chars. Digits, spaces and ponctuation are also allowed.

				This obviously implies that the hiding text must have at least 8 times
				more letters + 1 as the length of the text to hide.
				The mode give what one space represent:
					mode 0: " "==0, "  "==1
					mode 1: " "==1, "  "==0

				Example:
					hide('a b c d e f g h i j k l m n o p q r s t u v w x y z',"YOU")
						==> 'a b c  d e  f  g h i  j k  l m n  o  p  q  r s  t u  v w  x y  z'
					unhide('a b c  d e f  g  h i  j k  l m n o  p q  r s t u v w x y z')
						==> 'ME'
				

===== About Upper-Lower =====

				Upper-Lower is a steganographic tool which simply hides a short sentence
				into the letters of a bigger text. Alowed chars in text are strict lowercase
				chars. Digits, spaces and ponctuation are also allowed.

				This obviously implies that the hiding text must have at least 8 times
				more letters + 1 as the length of the text to hide.
				They are two modes:
					0: use lower-case as 0, upper-case as 1
					1: use lower-case as 1, upper-case as 0

				Example:
					hide("welcome to all of you to thehackademy.fr!","2012", mode=1) ==>
						'WelCOme To alL Of you to THehaCkaDEmy.Fr!'
					hide("welcome to all of you to thehackademy.fr!","2012", mode=0) ==>
						'wELcoME tO ALl oF YOU TO thEHAcKAdeMY.fR!'

					unhide('wELcoME tO ALl oF YOU TO thEHAcKAdeMY.fR!') ==>
						'tha'