diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/MD5.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WTF/wtf/MD5.cpp')
-rw-r--r-- | Source/WTF/wtf/MD5.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/WTF/wtf/MD5.cpp b/Source/WTF/wtf/MD5.cpp index 36549be83..55080f215 100644 --- a/Source/WTF/wtf/MD5.cpp +++ b/Source/WTF/wtf/MD5.cpp @@ -2,6 +2,7 @@ // Modifications Copyright 2006 Google Inc. All Rights Reserved /* * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -58,6 +59,25 @@ namespace WTF { +#if PLATFORM(COCOA) + +MD5::MD5() +{ + CC_MD5_Init(&m_context); +} + +void MD5::addBytes(const uint8_t* input, size_t length) +{ + CC_MD5_Update(&m_context, input, length); +} + +void MD5::checksum(Digest& hash) +{ + CC_MD5_Final(hash.data(), &m_context); +} + +#else + // Note: this code is harmless on little-endian machines. static void toLittleEndian(uint8_t* buf, unsigned longs) @@ -264,4 +284,6 @@ void MD5::checksum(Digest& digest) memset(m_in, 0, sizeof(m_in)); } +#endif + } // namespace WTF |