This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to tag v1.0.0
in repository osmium-tool.

commit 3388d65c0b564cca446ba80e82aa6285a48c6991
Author: Jochen Topf <joc...@topf.org>
Date:   Wed Mar 4 14:51:34 2015 +0100

    Use CRC32 instead of SHA checksum.
    
    This is much faster and should be enough for our use case, which is 
detecting
    data mangled on the network or disk by accident, not by malicious attack.
---
 .travis.yml              |  2 +-
 CMakeLists.txt           | 15 ---------------
 README.md                |  8 ++++----
 src/command_fileinfo.cpp | 30 +++++-------------------------
 src/main.cpp             |  6 ------
 5 files changed, 10 insertions(+), 51 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3f74c31..e5968cc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,7 +20,7 @@ install:
  - sudo rm /usr/bin/cpp
  - sudo ln -s /usr/bin/cpp-4.8 /usr/bin/cpp
  # upgrade libosmium dependencies
- - sudo apt-get install --yes make libboost-dev libboost-program-options-dev 
libprotobuf-dev protobuf-compiler libcrypto++-dev pandoc
+ - sudo apt-get install --yes make libboost-dev libboost-program-options-dev 
libprotobuf-dev protobuf-compiler pandoc
  - cd ..
  - git clone https://github.com/osmcode/libosmium.git
  # OSMPBF is too old, install from git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36208ce..e690c2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,14 +44,6 @@ include_directories(${Boost_INCLUDE_DIRS})
 find_package(Osmium REQUIRED COMPONENTS io)
 include_directories(${OSMIUM_INCLUDE_DIRS})
 
-#-----------------------------------------------------------------------------
-option(BUILD_WITH_CRYPTOPP "Build using libcryptopp" ON)
-
-if(BUILD_WITH_CRYPTOPP)
-    find_package(Cryptopp)
-    include_directories(${CRYPTOPP_INCLUDE_DIRS})
-endif()
-
 
 #-----------------------------------------------------------------------------
 #
@@ -251,13 +243,6 @@ if(PANDOC)
 endif()
 
 
-if(BUILD_WITH_CRYPTOPP AND CRYPTOPP_FOUND)
-    do_test(version_sha "osmium --version" "\nSHA support: enabled\n")
-else()
-    do_test(version_sha "osmium --version" "\nSHA support: disabled\n")
-endif()
-
-
 #-----------------------------------------------------------------------------
 
 include_directories(${PROJECT_BINARY_DIR}/src)
diff --git a/README.md b/README.md
index f77019f..9762fff 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,10 @@ later are known to work. You also need the following 
libraries:
         http://www.boost.org/doc/libs/1_54_0/doc/html/program_options.html
         Debian/Ubuntu: libboost-program-options-dev
 
+    boost-crc
+        http://www.boost.org/doc/libs/1_57_0/libs/crc/
+        Debian/Ubuntu: libboost-dev
+
     Google protocol buffers (for PBF support)
         http://code.google.com/p/protobuf/ (at least version 2.3.0 needed)
         Debian/Ubuntu: libprotobuf-dev protobuf-compiler
@@ -41,10 +45,6 @@ later are known to work. You also need the following 
libraries:
         Debian/Ubuntu: libexpat1-dev
         openSUSE: libexpat-devel
 
-    libcrypto++ (optional, for checksumming)
-        http://www.cryptopp.com/
-        Debian/Ubuntu: libcrypto++-dev
-
     cmake (for building)
         http://www.cmake.org/
         Debian/Ubuntu: cmake
diff --git a/src/command_fileinfo.cpp b/src/command_fileinfo.cpp
index bd5d466..b41a917 100644
--- a/src/command_fileinfo.cpp
+++ b/src/command_fileinfo.cpp
@@ -29,6 +29,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 # include <unistd.h>
 #endif
 
+#include <boost/crc.hpp>
 #include <boost/program_options.hpp>
 
 #include <osmium/io/any_input.hpp>
@@ -38,10 +39,6 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 #include "command_fileinfo.hpp"
 
-#ifdef OSMIUM_WITH_CRYPTOPP
-# include <cryptopp/sha.h>
-#endif
-
 bool CommandFileinfo::setup(const std::vector<std::string>& arguments) {
     namespace po = boost::program_options;
     po::variables_map vm;
@@ -102,28 +99,20 @@ struct InfoHandler : public osmium::handler::Handler {
     uint64_t relations = 0;
     osmium::Timestamp first_timestamp = osmium::end_of_time();
     osmium::Timestamp last_timestamp = osmium::start_of_time();
-#ifdef OSMIUM_WITH_CRYPTOPP
-    CryptoPP::SHA hash;
-#endif
+    boost::crc_32_type crc32;
 
     bool ordered = true;
     bool multiple_versions = false;
     osmium::item_type last_type = osmium::item_type::undefined;
     osmium::object_id_type last_id = 0;
 
-#ifdef OSMIUM_WITH_CRYPTOPP
     void changeset(const osmium::Changeset& changeset) {
-        hash.Update(changeset.data(), changeset.byte_size());
-#else
-    void changeset(const osmium::Changeset& /* changeset */) {
-#endif
+        crc32.process_bytes(changeset.data(), changeset.byte_size());
         ++changesets;
     }
 
     void osm_object(const osmium::OSMObject& object) {
-#ifdef OSMIUM_WITH_CRYPTOPP
-        hash.Update(object.data(), object.byte_size());
-#endif
+        crc32.process_bytes(object.data(), object.byte_size());
         if (object.timestamp() < first_timestamp) {
             first_timestamp = object.timestamp();
         }
@@ -221,16 +210,7 @@ bool CommandFileinfo::run() {
                 std::cout << "unknown (because objects in file are unordered)";
             }
 
-#ifdef OSMIUM_WITH_CRYPTOPP
-            unsigned char digest[CryptoPP::SHA::DIGESTSIZE];
-            info_handler.hash.Final(digest);
-            std::cout << "  SHA: " << std::hex;
-            for (int i=0; i < CryptoPP::SHA::DIGESTSIZE; ++i) {
-                std::cout << static_cast<int>(digest[i]);
-            }
-#endif
-
-            std::cout << std::dec << "\n";
+            std::cout << "  CRC32: " << std::hex << 
info_handler.crc32.checksum() << std::dec << "\n";
             std::cout << "  Number of changesets: " << info_handler.changesets 
<< "\n";
             std::cout << "  Number of nodes: " << info_handler.nodes << "\n";
             std::cout << "  Number of ways: " << info_handler.ways << "\n";
diff --git a/src/main.cpp b/src/main.cpp
index cfe5fa0..c65119e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -82,12 +82,6 @@ int main(int argc, char *argv[]) {
                   << "This is free software: you are free to change and 
redistribute it.\n"
                   << "There is NO WARRANTY, to the extent permitted by law.\n";
 
-#ifdef OSMIUM_WITH_CRYPTOPP
-        std::cout << "SHA support: enabled\n";
-#else
-        std::cout << "SHA support: disabled\n";
-#endif
-
         return return_code::okay;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/osmium-tool.git

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to