VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/TextReader.cpp
blob: 2606d1d58e50815dedd24aa43a014c6dc29cc6f4 (plain)
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
/*
 Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.

 Governed by the TrueCrypt License 3.0 the full text of which is contained in
 the file License.txt included in TrueCrypt binary and source code distribution
 packages.
*/

#include "TextReader.h"

namespace VeraCrypt
{
	TextReader::TextReader (const FilePath &path)
	{
		InputFile.reset (new File);
		InputFile->Open (path);
		InputStream = shared_ptr <Stream> (new FileStream (InputFile));
	}

	bool TextReader::ReadLine (string &outputString)
	{
		outputString.erase();

		char c;
		while (InputStream->Read (BufferPtr ((byte *) &c, sizeof (c))) == sizeof (c))
		{
			if (c == '\r')
				continue;

			if (c == '\n')
				return true;

			outputString += c;
		}
		return !outputString.empty();
	}
}
span> href="styles.css" rel="stylesheet" type="text/css" /> </head> <body> <div> <a href="https://www.veracrypt.fr/en/Home.html"><img src="VeraCrypt128x128.png" alt="VeraCrypt"/></a> </div> <div id="menu"> <ul> <li><a href="Home.html">Home</a></li> <li><a href="/code/">Source Code</a></li> <li><a href="Downloads.html">Downloads</a></li> <li><a class="active" href="Documentation.html">Documentation</a></li> <li><a href="Donation.html">Donate</a></li> <li><a href="https://sourceforge.net/p/veracrypt/discussion/" target="_blank">Forums</a></li> </ul> </div> <div> <p> <a href="Documentation.html">Documentation</a> <img src="arrow_right.gif" alt=">>" style="margin-top: 5px"> <a href="Technical%20Details.html">Technical Details</a> <img src="arrow_right.gif" alt=">>" style="margin-top: 5px"> <a href="Notation.html">Notation</a> </p></div> <div class="wikidoc"> <h1>Notation</h1> <p>&nbsp;</p> <table cellspacing="0"> <tbody> <tr> <td><em>C</em></td> <td>Ciphertext block</td> </tr> <tr> <td><em>DK()</em></td> <td>Decryption algorithm using encryption/decryption key <em>K</em></td> </tr> <tr> <td><em>EK()</em></td> <td>Encryption algorithm using encryption/decryption key <em>K</em></td> </tr> <tr> <td><em>H()</em></td> <td>Hash function</td> </tr> <tr> <td><em>i</em></td> <td>Block index for n-bit blocks; n is context-dependent</td> </tr> <tr> <td><em>K</em></td> <td>Cryptographic key</td> </tr> <tr> <td><em>^</em></td> <td>Bitwise exclusive-OR operation (XOR)</td> </tr> <tr> <td><em>&oplus;</em></td> <td>Modulo 2n addition, where n is the bit size of the left-most operand and of the resultant value (e.g., if the left operand is a 1-bit value, and the right operand is a 2-bit value, then: 1 &oplus; 0 = 1; 1 &oplus; 1 = 0; 1 &oplus; 2 = 1; 1 &oplus; 3 = 0; 0 &oplus; 0 = 0; 0 &oplus; 1 = 1; 0 &oplus; 2 = 0; 0 &oplus; 3 = 1)</td> </tr> <tr> <td><em>&otimes;</em></td> <td>Modular multiplication of two polynomials over the binary field GF(2) modulo x128&#43;x7&#43;x2&#43;x&#43;1 (GF stands for Galois Field)</td> </tr> <tr> <td><em>||</em></td> <td>Concatenation</td> </tr> </tbody> </table> <p>&nbsp;</p> <p><a href="Encryption%20Scheme.html" style="text-align:left; color:#0080c0; text-decoration:none; font-weight:bold.html">Next Section &gt;&gt;</a></p> </div> </body></html>