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
656d164c
Commit
656d164c
authored
Jul 16, 2019
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update watermarker driver
parent
f649775a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
pisn.cpp
src/pisn.cpp
+13
-3
snpi.cpp
src/snpi.cpp
+12
-4
No files found.
src/pisn.cpp
View file @
656d164c
...
...
@@ -4,16 +4,18 @@
#include "kyut/BitStreamWriter.hpp"
#include "kyut/watermarker/FunctionOrderingWatermarker.hpp"
#include "kyut/watermarker/OperandSwappingWatermarker.hpp"
int
main
(
int
argc
,
char
*
argv
[])
{
// Parse command line options
if
(
argc
!=
2
)
{
fmt
::
print
(
std
::
cerr
,
"{} <input file>
\n
"
,
argv
[
0
]);
if
(
argc
!=
3
)
{
fmt
::
print
(
std
::
cerr
,
"{} <input file>
<method>
\n
"
,
argv
[
0
]);
return
1
;
}
const
std
::
string
inputFile
=
argv
[
1
];
const
std
::
string
method
=
argv
[
2
];
try
{
// Read the input module
...
...
@@ -22,7 +24,15 @@ int main(int argc, char *argv[]) {
// Embed watermarks
kyut
::
BitStreamWriter
stream
;
kyut
::
watermarker
::
extractFunctionOrdering
(
module
,
stream
,
10
);
std
::
size_t
numBits
;
if
(
method
==
"opswap"
)
{
numBits
=
kyut
::
watermarker
::
extractOperandSwapping
(
module
,
stream
);
}
else
if
(
method
==
"funcord"
)
{
numBits
=
kyut
::
watermarker
::
extractFunctionOrdering
(
module
,
stream
,
10
);
}
else
{
throw
std
::
runtime_error
{
fmt
::
format
(
"unknown embedding method: {}"
,
method
)};
}
// Output watermarks extracted
std
::
cout
<<
stream
.
dataAsString
();
...
...
src/snpi.cpp
View file @
656d164c
...
...
@@ -4,17 +4,19 @@
#include "kyut/CircularBitStreamReader.hpp"
#include "kyut/watermarker/FunctionOrderingWatermarker.hpp"
#include "kyut/watermarker/OperandSwappingWatermarker.hpp"
int
main
(
int
argc
,
char
*
argv
[])
{
// Parse command line options
if
(
argc
!=
3
)
{
fmt
::
print
(
std
::
cerr
,
"{} <input file> <watermark>
\n
"
,
argv
[
0
]);
if
(
argc
!=
4
)
{
fmt
::
print
(
std
::
cerr
,
"{} <input file> <
method> <
watermark>
\n
"
,
argv
[
0
]);
return
1
;
}
const
std
::
string
inputFile
=
argv
[
1
];
const
std
::
string
watermark
=
argv
[
2
];
const
std
::
string
method
=
argv
[
2
];
const
std
::
string
watermark
=
argv
[
3
];
try
{
// Read the input module
...
...
@@ -24,7 +26,13 @@ int main(int argc, char *argv[]) {
// Embed watermarks
const
auto
stream
=
kyut
::
CircularBitStreamReader
::
fromString
(
watermark
);
if
(
method
==
"opswap"
)
{
kyut
::
watermarker
::
embedOperandSwapping
(
module
,
*
stream
);
}
else
if
(
method
==
"funcord"
)
{
kyut
::
watermarker
::
embedFunctionOrdering
(
module
,
*
stream
,
10
);
}
else
{
throw
std
::
runtime_error
{
fmt
::
format
(
"unknown embedding method: {}"
,
method
)};
}
// Output the result
wasm
::
ModuleWriter
{}.
writeText
(
module
,
""
);
...
...
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