crypto-toolbox 0.1.15 → 0.1.16

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: df8683094fec6537792c932072ef5cbf704e9229
4
- data.tar.gz: 675704384e2a84542f6dfba77a44dbdc09a52491
3
+ metadata.gz: 466b866a98ec3be521f61b4097c2c4346b301d6e
4
+ data.tar.gz: 6840f6e1882fd69e48a5d3bed909020cbfbd1089
5
5
  SHA512:
6
- metadata.gz: 1a1a771fdfeecf30f4db5db4c814d609c98ce779fe823d37e59f1c48cb026d846affa615042128ad53ff8393eb48fc78d3fb17d703a8f8eeb290c60f89a53497
7
- data.tar.gz: 3a5c2d78c13dac462077713ea4142a1a7bf280ea24e1b2ffc986ba1de190e0e6fd849b031069858d9316836ad990504db17999a74186ebc5a49178bb132622d2
6
+ metadata.gz: 68768144aae70032acc66b9dc7b1e247421cacb717c9b4f39857ef649eec2fb71b1ceb76a76b999e23a6a76cf77d7ace9c874c6f012cb406328ff41453d1234b
7
+ data.tar.gz: 11bc83467a87b7bb4bb3d862e458037ff0644144b9ace18fab2c4f79782ee99010a8438dd781d0c7f25a3a36868733f9b87439e8e057555b6b39b576aea8b779
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'crypto-toolbox'
4
+
5
+ if ARGV[0].nil?
6
+ $stderr.puts "Missing Argument: Message-to-tag (ascii string)"
7
+ else
8
+ message = ARGV[0]
9
+
10
+ Analyzers::CbcMac::VariableLength::Analyzer.new.analyze(message)
11
+ end
@@ -25,8 +25,7 @@ module Analyzers
25
25
 
26
26
  def mac(message)
27
27
  connect unless @mac_socket
28
-
29
- packet = ([message.length] + message.bytes + [0]).map(&:chr).join("")
28
+ packet = ( message.length.to_crypt_buffer + message + [0] ).chars.join("")
30
29
 
31
30
  @mac_socket.write(packet)
32
31
  @mac_socket.read(16)
@@ -36,8 +35,9 @@ module Analyzers
36
35
  connect unless @verify_socket
37
36
 
38
37
  # Message-length + message-chars + tag-chars + 0
39
- packet = ([message.length] + message.bytes + tag.split("") + [0]).map(&:chr).join("")
40
-
38
+ # NOTE: check why chars instead of bytes.map does not work here
39
+ packet = (message.length.to_crypt_buffer + message + tag.split("") + [0] ).bytes.map(&:chr).join("")
40
+
41
41
  @verify_socket.write(packet)
42
42
  @verify_socket.read(2).to_i
43
43
  end
@@ -10,6 +10,10 @@ module CryptBufferConcern
10
10
  CryptBuffer(bytes.shift(n))
11
11
  end
12
12
 
13
+ def unshift(anything)
14
+ CryptBuffer(bytes.unshift(anything))
15
+ end
16
+
13
17
  def first(n = 1 )
14
18
  CryptBuffer(bytes.first(n))
15
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crypto-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Sivia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aes
@@ -44,9 +44,11 @@ email: dev@d-coded.de
44
44
  executables:
45
45
  - break-vigenere-xor
46
46
  - break-padding-oracle
47
+ - break-cbc-mac-variable-length
47
48
  extensions: []
48
49
  extra_rdoc_files: []
49
50
  files:
51
+ - bin/break-cbc-mac-variable-length
50
52
  - bin/break-padding-oracle
51
53
  - bin/break-vigenere-xor
52
54
  - lib/crypto-toolbox.rb