binyo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ require 'binyo'
2
+
3
+ HEX_TABLE = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102]
4
+ HEX_TABLE_INV = [
5
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
6
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
7
+ -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1,
8
+ -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
9
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12,
10
+ 13, 14, 15
11
+ ] #102
12
+ HEX_INV_MAX = 102
13
+
14
+ module BinyoHex
15
+
16
+ def self.encode(data)
17
+ input = Binyo::ByteList.new(data)
18
+ bl = Binyo::ByteList.new(data.size * 2)
19
+ input.each do |b|
20
+ bl << HEX_TABLE[b >> 4]
21
+ bl << HEX_TABLE[b & 0x0f]
22
+ end
23
+ bl.to_s
24
+ end
25
+
26
+ end
27
+
28
+ data = "test" * 10000
29
+ 100.times do
30
+ BinyoHex.encode(data)
31
+ end
32
+
33
+
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: binyo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Martin Bosslet
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: binyo offers a generic C API for dealing with Ruby IO objects and extension
15
+ classes that allow to deal effectively with binary data
16
+ email: Martin.Bosslet@gmail.com
17
+ executables: []
18
+ extensions:
19
+ - ext/binyo/extconf.rb
20
+ extra_rdoc_files: []
21
+ files:
22
+ - LICENSE
23
+ - ext/binyo/io_out_fd.c
24
+ - ext/binyo/byte.h
25
+ - ext/binyo/io_out_bytes.c
26
+ - ext/binyo/binyo-io-buffer.h
27
+ - ext/binyo/binyo-missing.h
28
+ - ext/binyo/binyo.c
29
+ - ext/binyo/binyo.h
30
+ - ext/binyo/io_in_fd.c
31
+ - ext/binyo/io_in_generic.c
32
+ - ext/binyo/io_buffer.c
33
+ - ext/binyo/error.c
34
+ - ext/binyo/binyo-error.h
35
+ - ext/binyo/extconf.rb
36
+ - ext/binyo/binyo-io.h
37
+ - ext/binyo/io_in_seq.c
38
+ - ext/binyo/io_in_cache.c
39
+ - ext/binyo/bytelist.h
40
+ - ext/binyo/bytelist.c
41
+ - ext/binyo/io_out_generic.c
42
+ - ext/binyo/extconf.h
43
+ - ext/binyo/byte.c
44
+ - ext/binyo/binyo-error-internal.h
45
+ - ext/binyo/io.c
46
+ - ext/binyo/binyo-mem.h
47
+ - ext/binyo/io_in_bytes.c
48
+ - lib/binyo.rb
49
+ - lib/binyo.so
50
+ - test/scratch.rb
51
+ - test/hex.rb
52
+ homepage: https://github.com/krypt/binyo
53
+ licenses:
54
+ - MIT
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: 1.9.3
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 1.8.23
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Fast binary IO for Ruby
77
+ test_files: []