no-style-please2-plugins 0.8.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -11
- data/lib/enc.rb +24 -9
- data/lib/version/version.rb +1 -1
- data/test.rb +13 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4446905faa51bb7713c567160bd2461951a5ec5443ea219b5485efdc8ecbf2f
|
4
|
+
data.tar.gz: 900dfe6baaefc8bc5e13c8f6fba766ff856e845f753c7cf117e8daac2037e562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa92049758036c9a4256f13af7d10018a52c06f02cc4e473093aabc03c442d5c6c70f43883b90ee6e1308773f24242b4742ba918fe0729b84e89c2bb10908a22
|
7
|
+
data.tar.gz: f19c43180d4a043c9cb414aef28edc9900f682b81cc4d1419c77c3dc58c2acebd20cb6ffa878b51cda86936ca5cd1662871e288621e983b807bc179ce281f73e
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
no-style-please2-plugins (0.
|
4
|
+
no-style-please2-plugins (0.9.0)
|
5
5
|
digest
|
6
6
|
jekyll (~> 4.0)
|
7
|
-
ltec (~> 0.1.
|
7
|
+
ltec (~> 0.1.4)
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
12
|
addressable (2.8.7)
|
13
13
|
public_suffix (>= 2.0.2, < 7.0)
|
14
|
-
|
15
|
-
bigdecimal (3.1.8)
|
14
|
+
bigdecimal (3.1.9)
|
16
15
|
colorator (1.1.0)
|
17
|
-
concurrent-ruby (1.3.
|
16
|
+
concurrent-ruby (1.3.5)
|
18
17
|
digest (3.1.1)
|
19
18
|
em-websocket (0.5.3)
|
20
19
|
eventmachine (>= 0.12.9)
|
21
20
|
http_parser.rb (~> 0)
|
22
21
|
eventmachine (1.2.7)
|
23
|
-
ffi (1.17.
|
22
|
+
ffi (1.17.1-arm64-darwin)
|
24
23
|
forwardable-extended (2.6.0)
|
25
|
-
google-protobuf (4.29.
|
24
|
+
google-protobuf (4.29.3-arm64-darwin)
|
26
25
|
bigdecimal
|
27
26
|
rake (>= 13)
|
28
27
|
http_parser.rb (0.8.0)
|
@@ -56,8 +55,7 @@ GEM
|
|
56
55
|
listen (3.9.0)
|
57
56
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
58
57
|
rb-inotify (~> 0.9, >= 0.9.10)
|
59
|
-
ltec (0.1.
|
60
|
-
base64 (~> 0.1.0)
|
58
|
+
ltec (0.1.4)
|
61
59
|
openssl
|
62
60
|
mercenary (0.4.0)
|
63
61
|
openssl (3.3.0)
|
@@ -71,8 +69,8 @@ GEM
|
|
71
69
|
rexml (3.4.0)
|
72
70
|
rouge (4.5.1)
|
73
71
|
safe_yaml (1.0.5)
|
74
|
-
sass-embedded (1.
|
75
|
-
google-protobuf (~> 4.
|
72
|
+
sass-embedded (1.83.4-arm64-darwin)
|
73
|
+
google-protobuf (~> 4.29)
|
76
74
|
terminal-table (3.0.2)
|
77
75
|
unicode-display_width (>= 1.1.1, < 3)
|
78
76
|
unicode-display_width (2.6.0)
|
data/lib/enc.rb
CHANGED
@@ -94,6 +94,11 @@ module Jekyll
|
|
94
94
|
return "#{key}"
|
95
95
|
end
|
96
96
|
end
|
97
|
+
# 大端模式
|
98
|
+
def self.nmberToBinary4(num)
|
99
|
+
[num].pack("N")[0, 4]
|
100
|
+
end
|
101
|
+
|
97
102
|
module EncFilter
|
98
103
|
|
99
104
|
|
@@ -102,7 +107,7 @@ module Jekyll
|
|
102
107
|
str.unpack('C*').map{ |b| "%02x" % b }.join('')
|
103
108
|
end
|
104
109
|
|
105
|
-
def hex2bin(str)
|
110
|
+
def self.hex2bin(str)
|
106
111
|
[str].pack "H*"
|
107
112
|
end
|
108
113
|
def genKey(password)
|
@@ -171,30 +176,38 @@ module Jekyll
|
|
171
176
|
return bin2hex(OpenSSL::Random.random_bytes(n2))
|
172
177
|
end
|
173
178
|
|
179
|
+
|
174
180
|
def encrypt_content_v2(content,pswHex)
|
175
181
|
if !pswHex || pswHex.length != 64
|
176
182
|
raise "invalid Key:" + pswHex
|
177
183
|
end
|
178
|
-
cipher = OpenSSL::Cipher::AES.new(256, :
|
184
|
+
cipher = OpenSSL::Cipher::AES.new(256, :CTR).encrypt
|
179
185
|
iv = cipher.random_iv
|
180
186
|
cipher.iv = iv
|
181
|
-
cipher.key = hex2bin(pswHex)
|
187
|
+
cipher.key = EncFilter.hex2bin(pswHex)
|
182
188
|
encrypted = cipher.update(content) + cipher.final
|
183
|
-
return 'E2.' + Base64.strict_encode64(iv + encrypted )
|
184
|
-
end
|
185
189
|
|
190
|
+
|
191
|
+
len = 4 + iv.length + encrypted.length
|
192
|
+
lenBf = Jekyll.nmberToBinary4(len)
|
193
|
+
lenBf2 = lenBf.bytes.map.each_with_index do |v,i|
|
194
|
+
z = i ^ iv.bytes[i ]
|
195
|
+
v ^ z
|
196
|
+
end.pack('C*')
|
197
|
+
return Base64.strict_encode64(lenBf2 + iv + encrypted )
|
198
|
+
end
|
186
199
|
|
187
200
|
def encrypt_key(x,page,keyHex2Enc,encid)
|
188
201
|
arr = EncFilterTool.getAllKey(page)
|
189
202
|
newArr = arr.map do |k|
|
190
203
|
key = genKey encid + k + encid
|
191
204
|
hexKey = bin2hex key
|
192
|
-
encrypt_content_v2(hex2bin(keyHex2Enc),hexKey)
|
205
|
+
Base64.strict_decode64(encrypt_content_v2(EncFilter.hex2bin(keyHex2Enc),hexKey))
|
193
206
|
end
|
207
|
+
Base64.strict_encode64(newArr.join)
|
194
208
|
|
195
|
-
newArr.join('#')
|
196
209
|
end
|
197
|
-
|
210
|
+
|
198
211
|
|
199
212
|
|
200
213
|
end
|
@@ -202,7 +215,9 @@ module Jekyll
|
|
202
215
|
|
203
216
|
Liquid::Template.register_filter(Jekyll::EncFilter)
|
204
217
|
|
205
|
-
|
218
|
+
class Test
|
219
|
+
extend EncFilter
|
220
|
+
end
|
206
221
|
|
207
222
|
|
208
223
|
|
data/lib/version/version.rb
CHANGED
data/test.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'openssl'
|
4
4
|
require 'base64'
|
5
|
+
require_relative "lib/enc"
|
5
6
|
$Key = {}
|
6
7
|
def genKey(password)
|
7
8
|
cache = $Key[password]
|
@@ -51,6 +52,8 @@ def decrypt(enstring,password)
|
|
51
52
|
end
|
52
53
|
|
53
54
|
|
55
|
+
|
56
|
+
|
54
57
|
msg = '我的 12a23007'
|
55
58
|
z = encrypt msg,'123'
|
56
59
|
puts z
|
@@ -64,4 +67,13 @@ genKey '123'
|
|
64
67
|
genKey '123'
|
65
68
|
genKey '123'
|
66
69
|
genKey '456'
|
67
|
-
|
70
|
+
|
71
|
+
puts '---'
|
72
|
+
a = Jekyll::nmberToBinary4(256)
|
73
|
+
puts a.unpack1('H*')
|
74
|
+
a = a.bytes.map.each_with_index do |byte,i | byte ^ i
|
75
|
+
end.pack('C*')
|
76
|
+
|
77
|
+
puts a.unpack1('H*')
|
78
|
+
|
79
|
+
puts Jekyll::Test.encrypt_content_v2('333333a','00000000000000052f5c9b07ebc4464717978b174c440573df03e2962d98946c')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: no-style-please2-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vitock
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.
|
33
|
+
version: 0.1.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.1.
|
40
|
+
version: 0.1.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: digest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|