Cryptography Android application code samples / cipher collection for app users
This repository will slowly get more and more cryptography code samples written in Java. Methods are related to Cryptography android application cipher method collection. Point of this repository is that users can find everything in one place, modify code, play with these methods in any way they want and this way learn how ciphers worked in the past and how they work these days. In short words this repository is meant to be educational.
This repository is part of this Android application: Google Play - Cryptography
Feel free to contribute or open issues!
Cipher (or cypher) is an algorithm for performing encryption or decryption—a series of well-defined steps that can be followed as a procedure. Encryption is the process of encoding information. This process converts the original representation of the information, known as plaintext, into an alternative form known as ciphertext.
Converters converts input from representation system A to representation system B and vice versa.
Encoding is used to represent data in ASCII string format by translating the data into selected encoding representation.
A hash function is any function that can be used to map data of arbitrary size to fixed-size values. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes.
Random generation is a process which, often by means of a random number generator (RNG), generates a sequence of numbers or symbols that cannot be reasonably predicted better than by a random chance.
In computer security, an attribute certificate, or authorization certificate (AC) is a digital document containing attributes associated to the holder by the issuer. When the associated attributes are mainly used for the purpose of authorization, AC is called authorization certificate. AC is standardized in X.509. RFC 5755 further specifies the usage for authorization purpose in the Internet.
mathematical scheme for verifying the authenticity of digital messages or documents. A valid digital signature, where the prerequisites are satisfied, gives a recipient very strong reason to believe that the message was created by a known sender (authentication), and that the message was not altered in transit (integrity).
Clone or download
menu Download ZIP
option.File
- Open projects from File System...
/src
- cryptography
- Ciphers.java
and start play with it. Rest of the folder structure
has method specific code and tests files for running automated tests.I warmly recommend watching basic Eclipse tutorials if you are new to the topic.
./.github/workflows/Tests.yml
).TestRunner.java
Coverage As
1 Java Application
Tests success: true
Every time new external jar library is added, it must be also added to build.xml
in a block seen below as example
<path id="Cryptography.classpath">
<pathelement location="bin"/>
<path refid="JUnit 4.libraryclasspath"/>
<pathelement location="jar/commons-codec-1.10.jar"/>
<pathelement location="jar/jacksum.jar"/>
<pathelement location="jar/core-1.58.0.0.jar"/>
<pathelement location="jar/prov-1.58.0.0.jar"/>
<pathelement location="jar/bcpkix-jdk15on-1.58.0.0.jar"/>
<pathelement location="jar/bcpg-jdk15on-1.58.0.0.jar"/>
<pathelement location="jar/org.junit_4.13.0.v20200204-1500.jar"/>
<pathelement location="jar/core-1.3.0.jar"/>
<pathelement location="jar/bcprov-jdk15on-170"/>
<pathelement location="jar/bcpkix-jdk15on-170"/>
</path>
Some ciphers or parts of ciphers originate from web sites, tutorials, repositories or other sources. There's unfortunately no links to original references.
Noticed at Mac with jdk1.8.0...
[java.security.InvalidKeyException: Illegal key size or default parameters]>
this could be due to crypto policy being limited at java config. To change this, go to:
cd /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/security/
sudo nano java.security
and uncomment out crypto.policy=unlimited
:
Following did same trick but from code, so used this one:
import java.security.Security;
public class SomeClass {
public static void main(String[] args) {
Security.setProperty("crypto.policy", "unlimited");
}
}
See repo license section or license file.