From 5e7458b16135345243eeccf53b98e824e6fa3f69 Mon Sep 17 00:00:00 2001 From: xryuseix Date: Sun, 11 Jul 2021 03:40:26 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=8D=B5=E9=95=B7=E3=82=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cubing/out/cipher_text.txt | Bin 324 -> 324 bytes cubing/out/enc_key.key | 2 +- cubing/out/mask1.key | Bin 270 -> 270 bytes cubing/out/mask2.key | 4 ++-- cubing/src/main.rs | 14 +++++++++++--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cubing/out/cipher_text.txt b/cubing/out/cipher_text.txt index b22e23f72ddfacf14147f9590355b482187d375d..3ca43b7201a34e00b9671e13139b0eef7bbb3beb 100644 GIT binary patch literal 324 zcmV~$?UI2|002;bc?#@|kBF;oicB#QeQ9NP5q7I7#@w|EsfcIaa}s(WD>_U8ab!9! zSGAW8`*D2^3s-@kv<7poGiFK+-%Ug6w->@Wkntw6GBbXBp-rxhat~X9#Jq6e(%F7b}rGdlN5;}mtS>7wc1UXOccsh5!{G|L#g3h+h&35q{w^|gBC`gW; zyK>cIk#uN1#Q~$?7DM}pa#2n45mp1T>4Z#2sw3%mr@_sydhIa?&ooXXv$oD*hCA_)~^1xFy>2Y$IxWt9y! qrB5Y8jw=eR5rq0p_wao#3dCw_gk!8t84(btM4Fy63$Q%N-ONAI%3yf_ literal 324 zcmV~$eRD!^007|r&8G-=O9{VuDY1Fk3Z*W-?+77kNB-EMDzURsD>sk)?mo`bC zpbkSagxLHHk*2rKu&z|@O!f)6b-`|5K$iWEsQ{-W7v0Y7tvGRvQ$t!YQ{WJ^L70=} zAl9(1DFB@$YFj3yi5K2lzDyLY`D>+)fc+Y%kz=;FAdH{%CbfHO}lRg|G7Rm`cr zl|~>k+1EIEB7N}lQ3z)p%6ouh`16qBVUbI?Ru&;iF4SCfQ4QA7z3t*`z-XHGrxY7p z0R2%CxcN6UOk2G@_7+Ea|FKb<=40HQ`<`|Rp_sJ!o%tm`S2Jj4t#H(-K!b=<>bIEJ rdD&31Y2g@4HX0cP!uePm3p(|4c}V0qRBgHlISZMM5oieFv{a&hFz{VX diff --git a/cubing/out/enc_key.key b/cubing/out/enc_key.key index c50f627..5630bf9 100644 --- a/cubing/out/enc_key.key +++ b/cubing/out/enc_key.key @@ -1 +1 @@ -200021202021112021000100022002010010202102121112001221111220111000122002100122012211201100211201220110121011012202022121211210201221220201002022120202201000110122202111020210202112211101001011222110212121110021221112222210200200011121012101221221120200211102101200200022001211220112221001122000010100 \ No newline at end of file +210212202010221202020201200211022101200201100102202201011100122110010000001022102110101220000211021121121122010200122110201111221100211022201100212111102112121210022001112011110200002002222202011012210111121000101200100022212220110000022222121000102110120121202012002122210201120212111201100120020010212021101212212000100121022210012220101212110002010121021121210220121022021210002200002212111112002112021200210100102020001020011112000201110121100120210200012111022012001022120201211201220002210021110010002010022121200210021121202010221110220210010220200010221012021222012022210120212221220110102222020012200101111212221220010021200200020100211010210000001102221002221110102220120211220112011011021010020001012210012110212111202222012010002202202220002200220110220022222121112000120202112000221221012121000110011100212101022221201120101112110012220012212012000012122020220010012202010001220010202011201120120220020212201100202110000211220122111121010102221211212211012012000200211002122110210022222222202121000201101120212211120001211122210102112110222200020210210112202012101102210121200101020221101000220201220112210001102001012220122120001122101112021022101022201112012122210111220010011201120200000202122021200200002010111202122020020200220202021001200222001111112210012001111010001101211111022221021000221010020110221202000102021222110020102110122222210122020011002012101222102201100201020221220110020221001101001222011111022110002221001220211011110000021010212012222022121021201210102100120010212010101121200101212012020011020201021020112120221001100112201212112221221000200212211120120020201202200220200010102020121202121011102001012022111121012012122120120011122111020212021102201201021010210000222200101102110012120101201012211101101020111211210002021111010001201220002121022011201112202211000111021012201211122211211222000201210201110002002222012022100202000022102022100102210210202022021021121200110201000002222220020121021020112102101212201222110202201022201002122202202011101122200220202012100002002202100210202220221020200211000001212211111022001001200212000110011020210022111212222222200122110221020200000001220110010112020021210020222202101110120020011202211221001220012001122210001022000210011012002110021210020221120200222210011000120001100102121211122120010121221010212120102002201100112121011201112010010201011212121102012010022120122120200212020110211010002202022010200112021110201012111020121202020222220112002020122222202110001102000202200002011102012000010200112010022112221202010002112001210011120221000110022202222220122010121110022210222001100000111001210102220122100020020012101211010200000212001110210000200220120112022200112122001001102200021002102011001010210211101200021221111001002020121012110202222212012220002210010222211101222110210211221012201222110102020200121011120221111201021001020202011112001210211120022022120212222100221021022001202202202121212210221201121201021220011001010122022221110112121202100221110022112020120010121100202121000211212111001222110201 \ No newline at end of file diff --git a/cubing/out/mask1.key b/cubing/out/mask1.key index 17fa2eabe5cd8e2c743a5ac083971344c0b774bc..a76ddb89ebf1ce9dd46bc4400aeb02e8e4366a5e 100644 GIT binary patch literal 270 zcmV~$+fsr+007Wl^(#~qCmbkfbVU$kWz8L=afk$!&>FeOO_DAq+P8O3G|$i~^o}5Y zWx6|upX9x={JHh=SxlGy9PBuOQB%={gYNLLl_`cc9$J)(3}=eTTG^~L?d_${%29YH z2_G#YwIG@Wd!1{!PX~fc9vY)jgIcCgL`hsf1RYTp3KUSlcR?X7?Dn)dj>(g@xhjK- zN9%dGH$G0v{UafqgUo77^RHM75CmIBO_`Ys~efa$8bxciSwpEKbnd(3K Cpip}N literal 270 zcmV~$VRJ%Y007{=+ONonXmO!4z2%a!u5HI#+c_z3*H+RgGIbPw`<^EVdKCMJnN`{! z&aX!FbD&&)`J_sR9ezv3{wbs$g`HAoEu%G0{Oh}WV8cnM;MpYtmGGjtfTrT^Jo&c# zXA=7&rQYT301dVnZZK~*JE3-0HSN)F*s8%U(^Niewvsq)8y8IE$ak2%Bi&_}w8rJD zc3W(zM1+7i9gS<9vD_5u>ypHC>$6_Q5-l{qJlr7ud^84$EC&`^U!qbk?cttZ%v^_P z;AmiSdb!1LXx)O8i`T|pS0~=i(K_0K_h0=xVKSzYA0bnD;M$=}NTR;evUPtN{{zl< BP>}!t diff --git a/cubing/out/mask2.key b/cubing/out/mask2.key index 0aead35..b27bc73 100644 --- a/cubing/out/mask2.key +++ b/cubing/out/mask2.key @@ -1,2 +1,2 @@ -Xz&:n5> dG`jJMc)]kM1^Be -d>fu5^ \ No newline at end of file +OY_j;K5__5l6,c$ABH{SBd<[ +T_M3" \ No newline at end of file diff --git a/cubing/src/main.rs b/cubing/src/main.rs index 2106e45..76c6616 100644 --- a/cubing/src/main.rs +++ b/cubing/src/main.rs @@ -55,7 +55,12 @@ fn main() -> Result<()> { Some(key_file) => { key::key_convert(read_file(key_file, Some("key_text".to_string())).unwrap()) } - _ => key::key_generate(100), + _ => key::key_generate( + stdin(Some("key length".to_string())) + .unwrap() + .parse::() + .unwrap(), + ), }; let (cipher_text, mask1, mask2) = cubingmode::encrypt(encode::str_to_arr(plain_text), &key); write_file( @@ -73,7 +78,7 @@ fn main() -> Result<()> { }?; let key = match opts.key_file.clone() { Some(file) => key::key_convert(read_file(file, Some("key_text".to_string())).unwrap()), - _ => key::key_generate(100), + _ => key::key_convert(stdin(Some("key".to_string())).unwrap()), }; let mask1 = match opts.mask1_file { Some(file) => read_file(file, Some("mask1".to_string())), @@ -90,7 +95,10 @@ fn main() -> Result<()> { &key, ); write_file(plain_text.clone(), "plain_text.txt")?; - println!("decrypted: \n{}", (&plain_text[0..cmp::min(100, plain_text.len())]).to_string()); + println!( + "decrypted: \n{}", + (&plain_text[0..cmp::min(100, plain_text.len())]).to_string() + ); } Ok(()) }