FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cryptopp/cbcmac.cpp at master · doublethinkco/cryptopp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
doublethinkco
/
cryptopp
Public
forked from
weidai11/cryptopp
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cryptopp
/
cbcmac.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (48 loc) · 1.27 KB
Breadcrumbs
cryptopp
/
cbcmac.cpp
Copy path
File metadata and controls
62 lines (48 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
include
"
pch.h
"
#
ifndef
CRYPTOPP_IMPORTS
#
include
"
cbcmac.h
"
NAMESPACE_BEGIN
(CryptoPP)
void
CBC_MAC_Base::UncheckedSetKey
(
const
byte *key,
unsigned
int
length,
const
NameValuePairs ¶ms)
{
AccessCipher
().
SetKey
(key, length, params);
m_reg.
CleanNew
(
AccessCipher
().
BlockSize
());
m_counter =
0
;
}
void
CBC_MAC_Base::Update
(
const
byte *input,
size_t
length)
{
unsigned
int
blockSize =
AccessCipher
().
BlockSize
();
while
(m_counter && length)
{
m_reg[m_counter++] ^= *input++;
if
(m_counter == blockSize)
ProcessBuf
();
length--;
}
if
(length >= blockSize)
{
size_t
leftOver =
AccessCipher
().
AdvancedProcessBlocks
(m_reg, input, m_reg, length, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
input += (length - leftOver);
length = leftOver;
}
while
(length--)
{
m_reg[m_counter++] ^= *input++;
if
(m_counter == blockSize)
ProcessBuf
();
}
}
void
CBC_MAC_Base::TruncatedFinal
(byte *mac,
size_t
size)
{
ThrowIfInvalidTruncatedSize
(size);
if
(m_counter)
ProcessBuf
();
memcpy
(mac, m_reg, size);
memset
(m_reg,
0
,
AccessCipher
().
BlockSize
());
}
void
CBC_MAC_Base::ProcessBuf
()
{
AccessCipher
().
ProcessBlock
(m_reg);
m_counter =
0
;
}
NAMESPACE_END
#
endif
Back
|
FazBrowse Home
|
New Git URL