n_cipher 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
 - data/.codeclimate.yml +13 -0
 - data/README.md +7 -0
 - data/lib/n_cipher/version.rb +1 -1
 - data/lib/n_cipher.rb +3 -3
 - data/n_cipher.gemspec +1 -0
 - metadata +6 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6cd9e5cbf7ec143b9aac22c1196d8b9be2ef545a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b3a5a4a267f19bbcad97dc265093fc09e6eda655
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0178ed07ced51ac08b25f24609a0df49974d2ae817ab19edf148d387d9b00281a930cb98a0f90ff16d6c77ad61a64351d62f838bf1e2a3d55f75a2139a13ba05
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2722748a052d5cc3c7c691ac17f27e7943b9cf5b0953aeb1aa1bae8b5388bf655625b480b375fd9daf046be29051e994e773e244f814b7a36405682cf8fbfcf4
         
     | 
    
        data/.codeclimate.yml
    ADDED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,9 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # NCipher
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            [](https://rubygems.org/gems/n_cipher)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](#)
         
     | 
| 
       4 
5 
     | 
    
         
             
            [](https://travis-ci.org/844196/n_cipher)
         
     | 
| 
       5 
6 
     | 
    
         
             
            [](https://coveralls.io/github/844196/n_cipher)
         
     | 
| 
       6 
7 
     | 
    
         
             
            [](https://codeclimate.com/github/844196/n_cipher)
         
     | 
| 
      
 8 
     | 
    
         
            +
            [](https://github.com/844196/n_cipher/issues)
         
     | 
| 
      
 9 
     | 
    
         
            +
            [](#)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            文字列のUnicodeエスケープシーケンスを利用した簡易的な暗号です
         
     | 
| 
       7 
14 
     | 
    
         | 
| 
       8 
15 
     | 
    
         
             
            ## Installation
         
     | 
| 
       9 
16 
     | 
    
         | 
    
        data/lib/n_cipher/version.rb
    CHANGED
    
    
    
        data/lib/n_cipher.rb
    CHANGED
    
    | 
         @@ -16,11 +16,11 @@ module NCipher 
     | 
|
| 
       16 
16 
     | 
    
         
             
                    raise ArgumentError, 'Invalid argument.' if obj.empty?
         
     | 
| 
       17 
17 
     | 
    
         
             
                  end
         
     | 
| 
       18 
18 
     | 
    
         
             
                  raise ArgumentError, 'Seed must be 2 to 10 characters.' unless seed.size.between?(2, 10)
         
     | 
| 
       19 
     | 
    
         
            -
                  raise ArgumentError, 'Seed and delimiter are duplicated.' unless (seed.chars 
     | 
| 
      
 19 
     | 
    
         
            +
                  raise ArgumentError, 'Seed and delimiter are duplicated.' unless (seed.chars & delimiter.chars).size.zero?
         
     | 
| 
       20 
20 
     | 
    
         
             
                  # シード値が重複していないか?
         
     | 
| 
       21 
21 
     | 
    
         
             
                  #   OK: 'あいう'
         
     | 
| 
       22 
22 
     | 
    
         
             
                  #   NG: 'ああい'(「あ」が重複)
         
     | 
| 
       23 
     | 
    
         
            -
                  raise ArgumentError, 'Character is duplicated in seed.' unless seed. 
     | 
| 
      
 23 
     | 
    
         
            +
                  raise ArgumentError, 'Character is duplicated in seed.' unless seed.size == seed.chars.uniq.size
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
         @@ -35,7 +35,7 @@ module NCipher 
     | 
|
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
                def decode(string, seed: , delimiter: )
         
     | 
| 
       37 
37 
     | 
    
         
             
                  common_argument_check(string, seed, delimiter)
         
     | 
| 
       38 
     | 
    
         
            -
                  raise ArgumentError, 'Delimiter is not include in the cipher string.' unless  
     | 
| 
      
 38 
     | 
    
         
            +
                  raise ArgumentError, 'Delimiter is not include in the cipher string.' unless string.match(delimiter)
         
     | 
| 
       39 
39 
     | 
    
         
             
                  raise ArgumentError, 'Invalid cipher string.' unless (string.chars - "#{seed}#{delimiter}".chars).size.zero?
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                  string.split(delimiter).map {|ele| [ele.gsub(/./, convert_table(seed, :decode)).to_i(seed.size)].pack('U') }.join
         
     | 
    
        data/n_cipher.gemspec
    CHANGED
    
    | 
         @@ -19,6 +19,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       19 
19 
     | 
    
         
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       20 
20 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
              spec.required_ruby_version = '>= 2.1.0'
         
     | 
| 
       22 
23 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.9"
         
     | 
| 
       23 
24 
     | 
    
         
             
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
       24 
25 
     | 
    
         
             
              spec.add_development_dependency "test-unit"
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: n_cipher
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Masaya Takeda
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-10-12 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -80,7 +80,7 @@ dependencies: 
     | 
|
| 
       80 
80 
     | 
    
         
             
                - - ">="
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
82 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       83 
     | 
    
         
            -
            description: 文字列のUnicodeエスケープシーケンスを利用した簡易的な暗号です
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: "文字列のUnicodeエスケープシーケンスを利用した簡易的な暗号です"
         
     | 
| 
       84 
84 
     | 
    
         
             
            email:
         
     | 
| 
       85 
85 
     | 
    
         
             
            - 844196@gmail.com
         
     | 
| 
       86 
86 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -88,6 +88,7 @@ executables: 
     | 
|
| 
       88 
88 
     | 
    
         
             
            extensions: []
         
     | 
| 
       89 
89 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       90 
90 
     | 
    
         
             
            files:
         
     | 
| 
      
 91 
     | 
    
         
            +
            - ".codeclimate.yml"
         
     | 
| 
       91 
92 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       92 
93 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
       93 
94 
     | 
    
         
             
            - Gemfile
         
     | 
| 
         @@ -112,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       112 
113 
     | 
    
         
             
              requirements:
         
     | 
| 
       113 
114 
     | 
    
         
             
              - - ">="
         
     | 
| 
       114 
115 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       115 
     | 
    
         
            -
                  version:  
     | 
| 
      
 116 
     | 
    
         
            +
                  version: 2.1.0
         
     | 
| 
       116 
117 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       117 
118 
     | 
    
         
             
              requirements:
         
     | 
| 
       118 
119 
     | 
    
         
             
              - - ">="
         
     | 
| 
         @@ -123,5 +124,5 @@ rubyforge_project: 
     | 
|
| 
       123 
124 
     | 
    
         
             
            rubygems_version: 2.4.5.1
         
     | 
| 
       124 
125 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       125 
126 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       126 
     | 
    
         
            -
            summary: ぱすすにすに〜ぱすすゃぱす〜ぱすすんんに〜ぱすすゃにゃ〜ぱすすににん〜ぱすぱんぱゃ
         
     | 
| 
      
 127 
     | 
    
         
            +
            summary: "ぱすすにすに〜ぱすすゃぱす〜ぱすすんんに〜ぱすすゃにゃ〜ぱすすににん〜ぱすぱんぱゃ"
         
     | 
| 
       127 
128 
     | 
    
         
             
            test_files: []
         
     |