diff options
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 |