Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: Source/wtf/CryptographicallyRandomNumber.cpp

Issue 641643004: Reapply the non-MathExtras parts of (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/CheckedArithmetic.h ('k') | Source/wtf/DateMath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 1996, David Mazieres <dm@uun.org> 2 * Copyright (c) 1996, David Mazieres <dm@uun.org>
3 * Copyright (c) 2008, Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2008, Damien Miller <djm@openbsd.org>
4 * 4 *
5 * Permission to use, copy, modify, and distribute this software for any 5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies. 7 * copyright notice and this permission notice appear in all copies.
8 * 8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 inline uint32_t getWord(); 70 inline uint32_t getWord();
71 71
72 ARC4Stream m_stream; 72 ARC4Stream m_stream;
73 int m_count; 73 int m_count;
74 Mutex m_mutex; 74 Mutex m_mutex;
75 }; 75 };
76 76
77 ARC4Stream::ARC4Stream() 77 ARC4Stream::ARC4Stream()
78 { 78 {
79 for (int n = 0; n < 256; n++) 79 for (int n = 0; n < 256; n++)
80 s[n] = n; 80 s[n] = static_cast<uint8_t>(n);
81 i = 0; 81 i = 0;
82 j = 0; 82 j = 0;
83 } 83 }
84 84
85 ARC4RandomNumberGenerator::ARC4RandomNumberGenerator() 85 ARC4RandomNumberGenerator::ARC4RandomNumberGenerator()
86 : m_count(0) 86 : m_count(0)
87 { 87 {
88 } 88 }
89 89
90 void ARC4RandomNumberGenerator::addRandomData(unsigned char* data, int length) 90 void ARC4RandomNumberGenerator::addRandomData(unsigned char* data, int length)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 { 176 {
177 return sharedRandomNumberGenerator().randomNumber(); 177 return sharedRandomNumberGenerator().randomNumber();
178 } 178 }
179 179
180 void cryptographicallyRandomValues(void* buffer, size_t length) 180 void cryptographicallyRandomValues(void* buffer, size_t length)
181 { 181 {
182 sharedRandomNumberGenerator().randomValues(buffer, length); 182 sharedRandomNumberGenerator().randomValues(buffer, length);
183 } 183 }
184 184
185 } 185 }
OLDNEW
« no previous file with comments | « Source/wtf/CheckedArithmetic.h ('k') | Source/wtf/DateMath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698