Skip to content

Dayanfreitas/RSA

Repository files navigation

example workflow


RSA

Simple implementation gem of the RSA algorithm. Just academic reasons.

Key generation private and public

# key generation
RSA.generated 

Encode

# encode
RSA.encode('oi') 

Decode

# decode
RSA.decode(RSA.encode('oi')) 

User keys open

    ## For encoding
    
    RSA::OPEN::Public.n= <number>
    RSA::OPEN::Public.e= <number>
    RSA.encode('oi')

    ## For decoding    
    RSA::OPEN::Private.n = <number>
    RSA::OPEN::Private.d = <number>
    RSA.decode(RSA.encode('oi'))

Examples of implementation

Example folder. Intended for example using this gem

  • Simple
    Simplest way would be through RSA.generated. That way you will have the keys created in the keys folder and you can use

  • Open keys

    You can use open keys, for those not generated through RSA.generated that way you can set externally.

Development

init

make up

run teste

ruby test/all_test.rb

To learn more about: