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

Side by Side Diff: media/cast/test/crypto_utility.cc

Issue 62843002: Cast: Added support for AES-CTR crypto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 7 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2013 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 "media/cast/test/crypto_utility.h"
6
7 namespace {
8
9 char ConvertFromBase16Char(char base_16) {
10 DCHECK((base_16 >= '0' && base_16 <= '9') ||
11 (base_16 >= 'a' && base_16 <= 'f') ||
12 (base_16 >= 'A' && base_16 <= 'F'));
13
14 if (base_16 >= '0' && base_16 <= '9') {
15 return base_16 - '0';
16 }
17 if (base_16 >= 'a' && base_16 <= 'f') {
18 return base_16 - 'a' + 10;
19 }
20 return base_16 - 'A' + 10;
21 }
22 } // namespace
wtc 2013/11/13 20:57:17 Nit: add a blank line before this line. (This is p
pwestin 2013/11/15 19:38:17 removed this code
23
24 namespace media {
25 namespace cast {
26
27 std::string ConvertFromBase16String(const std::string base_16) {
28 std::string compressed;
29 DCHECK(base_16.size() % 2 == 0) << "Must be a multiple of 2";
30 compressed.reserve(base_16.size() / 2);
31
32 for (std::string::const_iterator it = base_16.begin(); it != base_16.end();
33 ++it) {
34 char first_part = ConvertFromBase16Char(*it++);
35 char second_part = ConvertFromBase16Char(*it);
36 compressed.push_back((first_part << 4) + second_part);
37 }
38 return compressed;
39 }
40
41 } // namespace cast
42 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698