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
/** | |
* Copyright (c) CI Wise Inc. All rights reserved. http://www.ciwise.com | |
* The software in this package is published under the terms of the Apache | |
* version 2.0 license, a copy of which has been included with this distribution | |
* in the LICENSE.txt file. | |
* | |
*/ | |
package com.ciwise.accounting.util; |
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
/** | |
* Copyright (c) CI Wise Inc. All rights reserved. http://www.ciwise.com | |
* The software in this package is published under the terms of the Apache | |
* version 2.0 license, a copy of which has been included with this distribution | |
* in the LICENSE.txt file. | |
* | |
*/ | |
package com.ciwise.accounting.util; |
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
package com.ciwise.accounting.config; | |
import java.util.Arrays; | |
import javax.inject.Inject; | |
import javax.sql.DataSource; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Autowired; |
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
package org.hoeggsoftware; | |
import org.mule.api.MuleEvent; | |
import org.mule.api.MuleException; | |
import org.mule.api.context.MuleContextAware; | |
import org.mule.api.routing.AggregationContext; | |
import org.mule.routing.AggregationStrategy; | |
import org.mule.api.MuleContext; | |
import org.mule.api.routing.RouterResultsHandler; | |
import org.mule.routing.DefaultRouterResultsHandler; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd | |
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd | |
http://www.mulesoft.org/schema/mule/apikit http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd | |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd | |
http://www.mulesoft.org/schema/mule/ |
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
pub fn wc_single_char_xor_encrypted_line(hex_line_60: &str) -> usize { | |
let mut best: usize = 0; | |
for x in 0..255 { | |
let hexkey = format!("{:02x}",x); | |
let bigkey = iter::repeat(hexkey).take(30).collect::<String>(); | |
let result = xor(hex_line_60,&bigkey); | |
let utf8_error = "UTF-8 Error".to_string(); | |
let s = match String::from_utf8(result) { | |
Ok(v) => v, |
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
#[test] | |
fn test_repeating_xor() { | |
use set1::challenge2::xor; | |
use rustc_serialize::hex::ToHex; | |
let plain_text_hex = "4275726e696e672027656d2c20696620796f752061696e277420717569636b20616e64206e696d626c650a4920676f206372617a79207768656e2049206865617220612063796d62616c"; | |
let key = "4943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943454943"; | |
let result = xor(plain_text_hex, key); | |
assert_eq!("0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f",result.to_hex()); | |
} |
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
//! # Examples | |
//! | |
//! ``` | |
//! extern crate rustc_serialize; | |
//! extern crate cryptowise; | |
//! use cryptowise::set1::challenge2::xor; | |
//! use rustc_serialize::hex::ToHex; | |
//! let a = "1c0111001f010100061a024b53535009181c"; | |
//! let b = "686974207468652062756c6c277320657965"; | |
//! let result = xor(a,b); |
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
guita@David-Asus MINGW64 /c/Development/Rust/projects/cryptowise (master) | |
$ cargo test | |
Running target\debug\cryptowise-637d5e98fd8788fc.exe | |
running 2 tests | |
test set1::challenge1::tests::it_works ... ok | |
test set1::challenge2::tests::it_works2 ... ok | |
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured |
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 crate rustc_serialize; | |
use rustc_serialize::hex::{FromHex,ToHex}; | |
/* | |
This is the application main | |
*/ | |
fn main() { | |
let a = "1c0111001f010100061a024b53535009181c"; |