Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
d22ec9d5
Commit
d22ec9d5
authored
Jan 14, 2024
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add name member to Key.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
959d98d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
random.cc
src/random.cc
+13
-0
random.hh
src/random.hh
+2
-0
No files found.
src/random.cc
View file @
d22ec9d5
...
...
@@ -21,6 +21,7 @@
#include <regex>
#include <assert.h>
#include <cinttypes>
using
std
::
string
;
using
std
::
vector
;
...
...
@@ -203,6 +204,7 @@ void
Key
::
set_test_key
(
uint64_t
key
)
{
uint64_to_buffer
(
key
,
m_aes_key
.
data
());
m_name
=
string_printf
(
"test-key-%"
PRId64
,
key
);
}
void
...
...
@@ -214,6 +216,11 @@ Key::load_key (const string& key_file)
error
(
"audiowmark: error opening key file: '%s'
\n
"
,
key_file
.
c_str
());
exit
(
1
);
}
m_name
=
key_file
;
// basename
size_t
sep
=
m_name
.
find_last_of
(
"
\\
/"
);
if
(
sep
!=
string
::
npos
)
m_name
=
m_name
.
substr
(
sep
+
1
);
const
regex
blank_re
(
R"(\s*(#.*)?[\r\n]+)"
);
const
regex
key_re
(
R"(\s*key\s+([0-9a-f]+)\s*(#.*)?[\r\n]+)"
);
...
...
@@ -269,3 +276,9 @@ Key::aes_key() const
assert
(
m_aes_key
.
size
()
==
SIZE
);
return
m_aes_key
.
data
();
}
const
string
&
Key
::
name
()
const
{
return
m_name
;
}
src/random.hh
View file @
d22ec9d5
...
...
@@ -28,6 +28,7 @@
class
Key
{
std
::
vector
<
unsigned
char
>
m_aes_key
;
std
::
string
m_name
;
public
:
static
constexpr
size_t
SIZE
=
16
;
/* 128 bits */
...
...
@@ -37,6 +38,7 @@ public:
void
set_test_key
(
uint64_t
key
);
void
load_key
(
const
std
::
string
&
filename
);
const
unsigned
char
*
aes_key
()
const
;
const
std
::
string
&
name
()
const
;
};
class
Random
...
...
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