commit d7085b90c8dd7684852339c4b0c6953db7863745 Author: Sean Bowe Date: Fri Mar 17 11:07:23 2017 -0600 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..1c9cc94 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,14 @@ +[root] +name = "librustzcash" +version = "0.1.0" +dependencies = [ + "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..91d9ca3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "librustzcash" +version = "0.1.0" +authors = ["Sean Bowe "] + +[lib] +name = "rustzcash" +path = "src/rustzcash.rs" +crate-type = ["staticlib"] + +[dependencies] +libc = "0.2" diff --git a/README.md b/README.md new file mode 100644 index 0000000..f65f262 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# librustzcash + +This repository contains librustzcash, a static library for Zcash code assets written in Rust. + +## License + +Licensed under either of + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual licensed as above, without any additional terms or +conditions. + diff --git a/src/rustzcash.rs b/src/rustzcash.rs new file mode 100644 index 0000000..e2b2739 --- /dev/null +++ b/src/rustzcash.rs @@ -0,0 +1,16 @@ +extern crate libc; +use libc::uint64_t; + +/// XOR two uint64_t values and return the result, used +/// as a temporary mechanism for introducing Rust into +/// Zcash. +#[no_mangle] +pub extern "system" fn librustzcash_xor(a: uint64_t, b: uint64_t) -> uint64_t +{ + a ^ b +} + +#[test] +fn test_xor() { + assert_eq!(librustzcash_xor(0x0f0f0f0f0f0f0f0f, 0x1111111111111111), 0x1e1e1e1e1e1e1e1e); +}