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

Unified Diff: chrome/browser/safe_browsing/binary_feature_extractor.cc

Issue 1015363003: Move BinaryFeatureExtractor and PEImageReader to common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@zip2
Patch Set: sync to position 321353 Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/binary_feature_extractor.cc
diff --git a/chrome/browser/safe_browsing/binary_feature_extractor.cc b/chrome/browser/safe_browsing/binary_feature_extractor.cc
deleted file mode 100644
index dee513bbd32a90e6adab852bd770a7f1dc091946..0000000000000000000000000000000000000000
--- a/chrome/browser/safe_browsing/binary_feature_extractor.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/safe_browsing/binary_feature_extractor.h"
-
-#include "base/files/file.h"
-#include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/common/safe_browsing/csd.pb.h"
-#include "crypto/secure_hash.h"
-#include "crypto/sha2.h"
-
-namespace safe_browsing {
-
-void BinaryFeatureExtractor::ExtractDigest(
- const base::FilePath& file_path,
- ClientDownloadRequest_Digests* digests) {
- base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
- if (file.IsValid()) {
- const int kBufferSize = 1 << 12;
- scoped_ptr<char[]> buf(new char[kBufferSize]);
- scoped_ptr<crypto::SecureHash> ctx(
- crypto::SecureHash::Create(crypto::SecureHash::SHA256));
- int len = 0;
- while (true) {
- len = file.ReadAtCurrentPos(buf.get(), kBufferSize);
- if (len <= 0)
- break;
- ctx->Update(buf.get(), len);
- }
- if (!len) {
- uint8_t hash[crypto::kSHA256Length];
- ctx->Finish(hash, sizeof(hash));
- digests->set_sha256(hash, sizeof(hash));
- }
- }
-}
-
-} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698