OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "public/platform/WebCryptoUtil.h" |
| 7 |
| 8 namespace blink { |
| 9 |
| 10 bool bigIntegerToUint(const WebVector<unsigned char>& bigInteger, unsigned& resu
lt) |
| 11 { |
| 12 result = 0; |
| 13 for (size_t i = 0; i < bigInteger.size(); ++i) { |
| 14 size_t iReversed = bigInteger.size() - i - 1; |
| 15 |
| 16 if (iReversed >= sizeof(result) && bigInteger[i]) |
| 17 return false; // Too large for unsigned int. |
| 18 |
| 19 result |= bigInteger[i] << 8 * iReversed; |
| 20 } |
| 21 return true; |
| 22 } |
| 23 |
| 24 } // namespace blink |
OLD | NEW |