Last active
December 25, 2015 18:09
-
-
Save qmx/7018680 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern mod extra; | |
use extra::getopts::groups::*; | |
use std::os; | |
use std::libc; | |
#[link_args = "-lsodium"] | |
extern { | |
fn crypto_box_curve25519xsalsa20poly1305_ref_keypair(pk: *mut libc::c_char, sk: *mut libc::c_char); | |
} | |
#[fixed_stack_segment] | |
fn main() { | |
let args = os::args(); | |
let program = args[0].clone(); | |
let opts = ~[ | |
optflag("h", "help", "show usage") | |
]; | |
let matches = match getopts(args.tail(), opts) { | |
Ok(m) => { m } | |
Err(f) => { fail!(f.to_err_msg()) } | |
}; | |
println(usage("meh", opts)); | |
let mut pk: [libc::c_char, ..32] = [0, ..32]; | |
let mut sk: [libc::c_char, ..32] = [0, ..32]; | |
println(pk.to_str()); | |
unsafe { | |
crypto_box_curve25519xsalsa20poly1305_ref_keypair(std::vec::raw::to_mut_ptr(pk), std::vec::raw::to_mut_ptr(sk)); | |
} | |
println(pk.to_str()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment