Giter Site home page Giter Site logo

muhammadiqbalafandi / classic-crytography-algorithm Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 213 KB

Provides a fast way to encrypt text with classic algorithms

Kotlin 100.00%
vigenere-cipher atbash-cipher android android-studio kotlin library encryption

classic-crytography-algorithm's Introduction

Classic Cryptography Algorithms

  1. Bahasa Indonesia

Instalation

Gradle

Always check the latest version

allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
 }
dependencies {
    implementation 'com.github.MuhammadIqbalAfandi:Classic-Cryptography-Algorithm:0.2.0-alpha'
}

Customization & Samples

APIs for Atbash Cipher Encryption and Decryption

Class Method Description
VigenereCipher encryption(plaintext: String, key: String): String A function that produces text encryption.
VigenereCipher decryption(ciphertext: String, key: String): String Function that returns the original text.

APIs for Vigenere Cipher Encryption and Decryption

Class Method Description
AtbashCipher encryption(plaintext: String): String A function that produces text encryption.
AtbashCipher decryption(ciphertext: String): String Function that returns the original text.

APIs for Helpers

Class Method Description
Helpers changeStringToAscii(string: String): MutableList Change the string value to ascii value.
Helpers changeAsciiToString(asciiArray: MutableList): String Change the ascii value to string value.
Helpers checkAsciiCharacterSupported(ascii: Int): Boolean Check whether the ascii value is the same as the supported ascii value.
Helpers getCharacterValue(index: Int): Int Retrieve character values based on index value.
Helpers getIndexValue(ascii: Int): Int Take the character index value.
Helpers removeSpace(string: String): String Removes spaces in the text.
Helpers repeatKeyWithKey(key: String, plaintext: String): String Repeat the key as much as the text to be encrypted.
Helpers repeatKeyWithPlaintext(key: String, plaintext: String): String Repeat the key as much as the text to be encrypted by adding the plaintext value to the key.
Helpers modulus(n: Int, m: Int): Int Modulus

Samples

Kotlin:

val plaintext = "ATTACKATDAWN"
val key = "LEMONLEMONLE"
val vigenereEncryptionResult = VigenereCipher.encryption(plaintext, key)
val vigenereDecryptionResult = VigenereCipher.decryption(vigenereEncryptionResult, key)
println("Encryption ->")
println(vigenereEncryptionResult)
println("Decryption ->")
println(vigenereDecryptionResult)

val atbashEncryptionResult = AtbashCipher.encryption(plaintext)
val atbashDecryptionResult = AtbashCipher.decryption(atbashEncryptionResult)
println("Encryption ->")
println(atbashEncryptionResult)
println("Decryption ->")
println(atbashDecryptionResult)

kotlin:

val text = "Kotlin Awesome"
val asciiValue = Helpers.changeStringToAscii(text)
println(asciiValue)

List Of Character Supported

"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\ ^_`abcdefghijklmnopqrstuvwxyz{|}~"

Supported Character Index Values

!  "  #  $  %  &  '  (  )  *  +   ,   -   .   /   0   1   2   3   4   5   6   7   8   9   :   ;   <   =   >   ?   @   A   B   C   D   E

0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36

F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _  `  a  b  c  d  e  f  g

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

How to Process Encryption and Decryption of Vigenere Cipher and Atbash Cipher in Applications

  1. Check each plaintext character (original text), what is the plaintext character included in the characters that are supported for encryption, please see here what characters can be encrypted.

  2. Encrypt every supported plaintext character, by searching the index value of each plaintext character please see here to see values index of each character, after getting the character index value input into the formula we get the character index value already in encryption, because the value is still in the form of an index take the character value based on the index you can see here. The same thing applies to decryption.

classic-crytography-algorithm's People

Watchers

 avatar  avatar

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.