SWE-350 TOTP Generator
Milestone 5
The DE-10 board has six 7-segment displays, this can be used to display and generate a time based one-time pin (TOTP).
Loading...
Searching...
No Matches
BitBuffer.hpp
Go to the documentation of this file.
1
/*
2
* QR Code generator library (C++)
3
*
4
* Copyright (c) Project Nayuki
5
* https://www.nayuki.io/page/qr-code-generator-library
6
*
7
* (MIT License)
8
* Permission is hereby granted, free of charge, to any person obtaining a copy of
9
* this software and associated documentation files (the "Software"), to deal in
10
* the Software without restriction, including without limitation the rights to
11
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
* the Software, and to permit persons to whom the Software is furnished to do so,
13
* subject to the following conditions:
14
* - The above copyright notice and this permission notice shall be included in
15
* all copies or substantial portions of the Software.
16
* - The Software is provided "as is", without warranty of any kind, express or
17
* implied, including but not limited to the warranties of merchantability,
18
* fitness for a particular purpose and noninfringement. In no event shall the
19
* authors or copyright holders be liable for any claim, damages or other
20
* liability, whether in an action of contract, tort or otherwise, arising from,
21
* out of or in connection with the Software or the use or other dealings in the
22
* Software.
23
*/
24
25
#pragma once
26
27
#include <cstdint>
28
#include <vector>
29
#include "
QrSegment.hpp
"
30
31
32
namespace
qrcodegen
{
33
34
/*
35
* An appendable sequence of bits. Bits are packed in big endian within a byte.
36
*/
37
class
BitBuffer
{
38
39
/*---- Fields ----*/
40
private
:
41
42
std::vector<uint8_t> data;
43
int
bitLength;
44
45
46
47
/*---- Constructor ----*/
48
public
:
49
50
// Creates an empty bit buffer (length 0).
51
BitBuffer
();
52
53
54
55
/*---- Methods ----*/
56
public
:
57
58
// Returns the number of bits in the buffer, which is a non-negative value.
59
int
getBitLength
()
const
;
60
61
62
// Returns a copy of all bytes, padding up to the nearest byte.
63
std::vector<uint8_t>
getBytes
()
const
;
64
65
66
// Appends the given number of bits of the given value to this sequence.
67
// If 0 <= len <= 31, then this requires 0 <= val < 2^len.
68
void
appendBits
(uint32_t val,
int
len);
69
70
71
// Appends the data of the given segment to this bit buffer.
72
void
appendData
(
const
QrSegment
&seg);
73
74
};
75
76
}
QrSegment.hpp
qrcodegen::BitBuffer
Definition
BitBuffer.hpp:37
qrcodegen::BitBuffer::getBytes
std::vector< uint8_t > getBytes() const
Definition
BitBuffer.cpp:39
qrcodegen::BitBuffer::appendData
void appendData(const QrSegment &seg)
Definition
BitBuffer.cpp:55
qrcodegen::BitBuffer::BitBuffer
BitBuffer()
Definition
BitBuffer.cpp:29
qrcodegen::BitBuffer::getBitLength
int getBitLength() const
Definition
BitBuffer.cpp:34
qrcodegen::BitBuffer::appendBits
void appendBits(uint32_t val, int len)
Definition
BitBuffer.cpp:44
qrcodegen::QrSegment
Definition
QrSegment.hpp:41
qrcodegen
Definition
BitBuffer.hpp:32
QRCode
tests
BitBuffer.hpp
Generated by
1.12.0