Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2577681
crypto-util.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
crypto-util.hpp
View Options
/*
* Copyright (C) 2020 Tusooa Zhu <tusooa@vista.aero>
*
* This file is part of libkazv.
*
* libkazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* libkazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with libkazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include
<random>
#include
<algorithm>
#include
<vector>
namespace
Kazv
{
using
ByteArray
=
std
::
vector
<
char
>
;
[[
nodiscard
]]
inline
ByteArray
genRandom
(
int
len
)
{
auto
rd
=
std
::
random_device
{};
auto
ret
=
ByteArray
(
len
,
'\0'
);
std
::
generate
(
ret
.
begin
(),
ret
.
end
(),
[
&
]
{
return
rd
();
});
return
ret
;
}
namespace
CryptoConstants
{
inline
const
std
::
string
ed25519
{
"ed25519"
};
inline
const
std
::
string
curve25519
{
"curve25519"
};
inline
const
std
::
string
olmAlgo
{
"m.olm.v1.curve25519-aes-sha2"
};
inline
const
std
::
string
megOlmAlgo
{
"m.megolm.v1.aes-sha2"
};
}
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Tue, Jun 24, 12:03 PM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
234852
Default Alt Text
crypto-util.hpp (1 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment