Giter Club home page Giter Club logo

cryptography's Introduction

Cryptography Image 1

Cryptography

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!

Table of contents


Ciphers

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

Converters converts input from representation system A to representation system B and vice versa.

Encoding

Encoding is used to represent data in ASCII string format by translating the data into selected encoding representation.

Hashes

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

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.

Certificates

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.

Signatures

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).


Installation

  1. Download and install eclipse: https://www.eclipse.org/downloads/ or any other IDE.
  2. Download project source code by either cloning it with Git or by Clone or download menu Download ZIP option.
  3. Open project in Eclipse File - Open projects from File System...
  4. Navigate to /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.

Running tests

Automatically

  1. Make new branch.
  2. Push changes. (tests will be run with each push)
  3. Open pull request.
  4. Later tests are run by Github Actions workflow (./.github/workflows/Tests.yml).

Manually

  1. Right click on TestRunner.java
  2. Click Coverage As
  3. Select 1 Java Application
  4. If everything is fine result is Tests success: true

External libraries

commons-codec-1.10.jar

  • Included for Base32 and Base64 encoding methods.

jacksum-1.7.0 (jacksum.jar)

core-1.58.0.0.jar | prov-1.58.0.0.jar | bcpg-jdk15on-1.58.0.0.jar | bcpkix-jdk15on-1.58.0.0.jar (Spongy Castle)

bcprov-jdk15on-170

  • BouncyCastle signed cryptography provider

bcpkix-jdk15on-170

  • BouncyCastle signed cryptography provider

org.junit_4.13.0.v20200204-1500.jar | core-1.3.0.jar

  • JUnit 4 jar and hamcrest core for Github Actions based test runs.

Adding external library

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>

Notes

Some ciphers or parts of ciphers originate from web sites, tutorials, repositories or other sources. There's unfortunately no links to original references.

Troubleshooting

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: Cryptography Image 1

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");
    }
}

Contributions

Rules?

  • Please, write tests if you make something new.

Found problem?

  • Open issue or make new branch and create pull request when problem is fixed.

Want to optimize code?

  • You are free to optimize code, make new branch and create pull request when ready.

Authors

Contributors

  • Saurav Kumar - *Added Morse, Huffman, Compliment, Koblitz, EllipticCurve, VICsequencing, VIC * - SKR301

License

See repo license section or license file.

cryptography's People

Contributors

norkator avatar skr301 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cryptography's Issues

VIC further checks

  • Try VIC implementation against some online tools.

If passing upper one, then:

  • Implement VIC into Cryptography Android application.

vernam cipher

User requested. Looks to be another name for One Time Pad cipher.

Argon2 incomplete

The Argon2 implementation in the app seems incomplete.

Any plans to release an update with full parameter support, like already done for the SCrypt screen?

VIC cipher

Add VIC cipher: https://en.wikipedia.org/wiki/VIC_cipher

Part of the user comment: "...American scientists in the cold war Era and was pretty historically famous. It is probably the most sophisticated "by hand" cipher that can be done in reasonable time with only pen and paper...."

After developing/adding it here, will add to to Cryptography Android app.

Elgamal Jenkins tests problem

Maybe Jenkins JDK version used with Ant here is causing: JCE cannot authenticate the provider BC for BC = BouncyCastle provider.

您好作者,希望开通支付宝移除广告功能

来自**的粉丝,倒霉的谷歌市场限制了我在**购买移除广告的消费。而我只能赞助0.99美元,我希望能有一个支付宝移除广告的办法。谢谢,同时我也希望能添加下菜单的中文翻译。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.