crypto-toolbox 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3741ee0a5c8778cb587e0d5d09edcc2f4bbfc3d
4
- data.tar.gz: 25d0542625cd02941089b3b4221ace37d7f1fb79
3
+ metadata.gz: f859d425d099a7e3b6f3ee8539f4696f6634a737
4
+ data.tar.gz: a46d807728e9a1a06b5a8fb952b5099c1d6fd120
5
5
  SHA512:
6
- metadata.gz: 17e284a7a3d444e62a97195009224602c2094d9fcb88cf35d6471f62913515e4ae0ba1dff7e444bf08777cfe16a1037a0ae81ee356d36d1051ff4e2b8fb795e0
7
- data.tar.gz: cd3a356208dc66f42e98f84b83f9253a1ec5c7431cc9734e4cced2d0817275359655727abb79581a286d4a014233914a7d5fa89e4ee035b2e8cbd56d8591c043
6
+ metadata.gz: 3c9dcb0a0f708fe300fb9973ae7ff0af5989e2c2c4e60ae50eb25113b7f1644ec63586bb1eacdcb1b421c514159306920cb1f755e8c5def6b8b2aed2aa440e01
7
+ data.tar.gz: f0a06366f6f4b03183dbd77352842d542cc2d9ae79e086cfc90303b545d0b43c73afbd66453ed31f8946c4ba74c45b3f281298cb467fe76b9d0eb43688b302f7
@@ -15,15 +15,19 @@ module Ciphers
15
15
  def encode(message,shift)
16
16
  assert_valid_shift!(shift)
17
17
  real_shift = convert_shift(shift)
18
- CryptBuffer.new(message).add(real_shift, mod: 91, offset: 65).str
18
+
19
+ message.split("").map do|part|
20
+ part == " " ? part : CryptBuffer.new(part).add(real_shift, mod: 91, offset: 65).str
21
+ end.join
19
22
  end
20
23
 
21
24
  def decode(message,shift)
22
25
  assert_valid_shift!(shift)
23
26
  real_shift = convert_shift(shift)
24
- # first reduce by 65 to map A to 0 ; then mod-sub with "A"(91)-65; and re-add the 65 to convert back to real ascii A value
25
- result = CryptBuffer(message).sub(65).mod_sub(real_shift,mod: 91-65).add(65)
26
- result.str
27
+ message.split("").map do |part|
28
+ # first reduce by 65 to map A to 0 ; then mod-sub with "A"(91)-65; and re-add the 65 to convert back to real ascii A value
29
+ part == " " ? part : CryptBuffer(part).sub(65).mod_sub(real_shift,mod: 91-65).add(65).str
30
+ end.join
27
31
  end
28
32
  private
29
33
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crypto-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Sivia