snailcrypt
Library to access api.snailcrypt.com
Example usages
Encrypting a string
To encrypt a string for a given date you can place the following code in your application:
use ;
use Rc;
use ;
/**
* Setup main input data
*/
let plaintext = Stringfrom;
let hint = Stringfrom;
/**
* Produce a client
*/
let analyzer_factory: AnalyzerFactory = new;
let analyzer: = analyzer_factory.create;
let config_factory: ConfigFactory = new;
let config: = config_factory.create;
let client_factory: ClientFactory = new;
let client: = client_factory.create;
let lockdate: = parse_from_str
.unwrap_or_else;
/**
* Perform encryption using the client
*/
let cipher: String = client.encrypt
.unwrap_or_else;
Decrypting a string
To decrypt a snailcrypt string you can place the following code in your application:
use ;
use Rc;
use ;
/**
* Setup main input data
*/
let cipher: String = Stringfrom;
/**
* Produce a client
*/
let analyzer_factory: AnalyzerFactory = new;
let analyzer: = analyzer_factory.create;
let config_factory: ConfigFactory = new;
let config: = config_factory.create;
let client_factory: ClientFactory = new;
let client: = client_factory.create;
/**
* Perform decryption using the client
*/
let result = client
.decrypt
.unwrap_or_else;
println!;
println!;