Botan
3.7.1
Crypto and TLS for C&
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
c
d
f
i
m
n
r
s
t
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
f
h
i
m
n
o
p
r
s
t
u
v
w
Enumerations
b
c
d
e
k
m
n
o
p
s
t
x
Enumerator
_
a
b
c
d
e
f
h
k
l
m
n
p
q
r
s
t
u
w
x
Related Symbols
b
c
d
e
f
k
o
p
s
t
x
Files
File List
File Members
All
_
a
b
c
d
e
f
i
k
m
n
o
p
q
s
t
u
w
x
y
z
Functions
b
c
Variables
Typedefs
b
c
e
p
t
Enumerations
Enumerator
b
c
d
e
k
n
Macros
_
a
b
c
f
m
n
q
s
t
w
src
lib
math
bigint
big_io.cpp
Go to the documentation of this file.
1
/*
2
* BigInt Input/Output
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#include <botan/bigint.h>
9
#include <istream>
10
#include <ostream>
11
12
namespace
Botan
{
13
14
/*
15
* Write the BigInt into a stream
16
*/
17
std::ostream&
operator<<
(std::ostream& stream,
const
BigInt
& n) {
18
const
auto
stream_flags = stream.flags();
19
// NOLINTNEXTLINE(*-non-zero-enum-to-bool-conversion)
20
if
(stream_flags & std::ios::oct) {
21
throw
Invalid_Argument
(
"Octal output of BigInt not supported"
);
22
}
23
24
// NOLINTNEXTLINE(*-non-zero-enum-to-bool-conversion)
25
const
size_t
base = (stream_flags & std::ios::hex) ? 16 : 10;
26
27
if
(base == 10) {
28
stream << n.
to_dec_string
();
29
}
else
{
30
stream << n.
to_hex_string
();
31
}
32
33
if
(!stream.good()) {
34
throw
Stream_IO_Error
(
"BigInt output operator has failed"
);
35
}
36
return
stream;
37
}
17
std::ostream&
operator<<
(std::ostream& stream,
const
BigInt
& n) {
…
}
38
39
/*
40
* Read the BigInt from a stream
41
*/
42
std::istream&
operator>>
(std::istream& stream,
BigInt
& n) {
43
std::string str;
44
std::getline(stream, str);
45
if
(stream.bad() || (stream.fail() && !stream.eof())) {
46
throw
Stream_IO_Error
(
"BigInt input operator has failed"
);
47
}
48
n =
BigInt
(str);
49
return
stream;
50
}
42
std::istream&
operator>>
(std::istream& stream,
BigInt
& n) {
…
}
51
52
}
// namespace Botan
Botan::BigInt
Definition
bigint.h:26
Botan::BigInt::to_dec_string
std::string to_dec_string() const
Definition
big_code.cpp:16
Botan::BigInt::to_hex_string
std::string to_hex_string() const
Definition
big_code.cpp:86
Botan::Invalid_Argument
Definition
exceptn.h:131
Botan::Stream_IO_Error
Definition
exceptn.h:288
Botan
Definition
alg_id.cpp:13
Botan::operator<<
std::ostream & operator<<(std::ostream &out, const OID &oid)
Definition
asn1_obj.h:330
Botan::operator>>
int operator>>(int fd, Pipe &pipe)
Definition
fd_unix.cpp:39
Generated by
1.12.0