From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WTF/wtf/MD5.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Source/WTF/wtf/MD5.cpp') 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 -- cgit v1.2.1