Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
54819b62
Verified
Commit
54819b62
authored
Jan 07, 2021
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
calculate extraction rate using levenshtein distance
parent
3c4c6c0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
check_extract.rb
scripts/check_extract.rb
+9
-1
common.rb
scripts/common.rb
+1
-1
No files found.
scripts/check_extract.rb
View file @
54819b62
#!/usr/bin/env ruby
#!/usr/bin/env ruby
require_relative
'./common'
require_relative
'./common'
require
'amatch'
watermark
=
WATERMARK
watermark
=
WATERMARK
...
@@ -10,7 +11,14 @@ METHODS.each do |method|
...
@@ -10,7 +11,14 @@ METHODS.each do |method|
OPT_PASSES
.
each
do
|
pass
|
OPT_PASSES
.
each
do
|
pass
|
b
=
a
.
to_s
.
end_with?
(
".wasm.txt"
)
?
a
.
sub
(
".wasm.txt"
,
"-
#{
pass
}
.wasm.txt"
)
:
a
.
sub
(
".txt"
,
"-
#{
pass
}
.txt"
)
b
=
a
.
to_s
.
end_with?
(
".wasm.txt"
)
?
a
.
sub
(
".wasm.txt"
,
"-
#{
pass
}
.wasm.txt"
)
:
a
.
sub
(
".txt"
,
"-
#{
pass
}
.txt"
)
puts
"
#{
a
.
basename
}
-
#{
b
.
basename
}
:
#{
method
[
:name
]
}
,
#{
pass
}
,
#{
FileUtils
.
cmp
(
a
,
b
)
?
"○"
:
"☓"
}
"
a_lines
=
File
.
readlines
(
a
)
b_lines
=
File
.
readlines
(
b
)
a_bits
=
a_lines
[
0
].
to_i
b_bits
=
b_lines
[
0
].
to_i
a_wm
=
[
a_lines
[
1
]].
pack
(
"H*"
).
unpack
(
"B*"
)[
0
][
0
,
a_bits
]
b_wm
=
[
b_lines
[
1
]].
pack
(
"H*"
).
unpack
(
"B*"
)[
0
][
0
,
b_bits
]
puts
"
#{
a
.
basename
}
,
#{
b
.
basename
}
,
#{
method
[
:name
]
}
,
#{
pass
}
,
#{
a_bits
}
,
#{
b_bits
}
,
#{
a_wm
.
levenshtein_similar
(
b_wm
)
}
"
end
end
end
if
method
[
:name
]
!=
"null"
end
if
method
[
:name
]
!=
"null"
end
end
scripts/common.rb
View file @
54819b62
...
@@ -77,7 +77,7 @@ OPT_PASSES = [
...
@@ -77,7 +77,7 @@ OPT_PASSES = [
WATERMARK
=
"N7AStlK2gioIqeRi"
WATERMARK
=
"N7AStlK2gioIqeRi"
def
copy
(
file
,
out
)
def
copy
(
file
,
out
)
FileUtils
.
copy
(
file
,
out
,
{
:verbose
=>
true
}
)
FileUtils
.
copy
(
file
,
out
)
end
end
def
embed
(
file
,
out
,
method
,
watermark
,
chunk_size
=
20
)
def
embed
(
file
,
out
,
method
,
watermark
,
chunk_size
=
20
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment