enhance(spiral):统一螺旋算法的特性,如果起始位和长度检测失败,则直接返回密文。
This commit is contained in:
parent
dbcdfc426e
commit
3f86e75518
|
@ -40,7 +40,7 @@ pub fn encrypt(data: String) -> String {
|
|||
/// - `data` 待解密的内容
|
||||
pub fn decrypt(data: String) -> Result<String, SpiralCipherError> {
|
||||
if !data.starts_with("[") || data.len() <= 21 {
|
||||
return Err(SpiralCipherError::CorruptedCipherData);
|
||||
return Ok(data);
|
||||
}
|
||||
let data = data[1..].to_string();
|
||||
let key_seed = data[0..20].to_string();
|
||||
|
|
Loading…
Reference in New Issue
Block a user