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
6110c629
Commit
6110c629
authored
Jul 11, 2019
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement the watermark extractor driver
parent
80ae6441
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
1 deletion
+59
-1
CMakeLists.txt
src/CMakeLists.txt
+8
-0
BitStreamWriter.hpp
src/kyut/BitStreamWriter.hpp
+9
-1
pisn.cpp
src/pisn.cpp
+42
-0
No files found.
src/CMakeLists.txt
View file @
6110c629
...
...
@@ -14,3 +14,11 @@ add_executable(snpi
target_link_libraries
(
snpi
kyut
)
add_executable
(
pisn
pisn.cpp
)
target_link_libraries
(
pisn
kyut
)
src/kyut/BitStreamWriter.hpp
View file @
6110c629
...
...
@@ -3,6 +3,7 @@
#include <cassert>
#include <cstdint>
#include <string_view>
#include <vector>
namespace
kyut
{
...
...
@@ -24,7 +25,14 @@ namespace kyut {
return
data_
;
}
[[
nodiscard
]]
std
::
size_t
tell
()
const
noexcept
{
[[
nodiscard
]]
std
::
string_view
dataAsString
()
const
{
return
std
::
string_view
{
reinterpret_cast
<
const
char
*>
(
data_
.
data
()),
data_
.
size
(),
};
}
[[
nodiscard
]]
std
::
size_t
tell
()
const
noexcept
{
return
pos_write_
;
}
...
...
src/pisn.cpp
0 → 100644
View file @
6110c629
#include <fmt/printf.h>
#include <wasm-io.h>
#include "kyut/BitStreamWriter.hpp"
#include "kyut/watermarker/FunctionOrderingWatermarker.hpp"
int
main
(
int
argc
,
char
*
argv
[])
{
// Parse command line options
if
(
argc
!=
2
)
{
fmt
::
print
(
std
::
cerr
,
"{} <input file>
\n
"
,
argv
[
0
]);
return
1
;
}
const
std
::
string
inputFile
=
argv
[
1
];
try
{
// Read the input module
wasm
::
Module
module
;
wasm
::
ModuleReader
{}.
read
(
inputFile
,
module
);
// Embed watermarks
kyut
::
BitStreamWriter
stream
;
kyut
::
watermarker
::
extractFunctionOrdering
(
module
,
stream
,
10
);
// Output watermarks extracted
std
::
cout
<<
stream
.
dataAsString
();
}
catch
(
const
wasm
::
ParseException
&
e
)
{
e
.
dump
(
std
::
cerr
);
return
1
;
}
catch
(
const
std
::
exception
&
e
)
{
fmt
::
print
(
std
::
cerr
,
"exception: {}
\n
"
,
e
.
what
());
return
1
;
}
catch
(...)
{
fmt
::
print
(
std
::
cerr
,
"unknown exception
\n
"
);
return
1
;
}
}
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