crypto/weakcryptospi/source/random/messagedigest.cpp
branchRCL_3
changeset 41 9b5a3a9fddf8
parent 37 721a5e5fe251
child 42 eb9b28acd381
equal deleted inserted replaced
37:721a5e5fe251 41:9b5a3a9fddf8
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * hash.cpp
       
    16 * (c) 1999-2003 Symbian Ltd. All rights reserved
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23 */
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <hash.h>
       
    27 #include "sha1shim.h"
       
    28 
       
    29 CMessageDigest::CMessageDigest(void):CBase()
       
    30 {}
       
    31 
       
    32 CMessageDigest::CMessageDigest(const CMessageDigest& /*aMD*/):CBase()
       
    33 {}
       
    34 
       
    35 CMessageDigest::~CMessageDigest(void)
       
    36 {}
       
    37 
       
    38 TInt CMessageDigest::GetExtension(TUint aExtensionId, TAny*& a0, TAny* a1)
       
    39 	{
       
    40 	return Extension_(aExtensionId, a0, a1);
       
    41 	}
       
    42 
       
    43 
       
    44 //////////////////////////////////////////////////////////////////
       
    45 //	Factory class to create CMessageDigest derived objects
       
    46 //////////////////////////////////////////////////////////////////
       
    47 CMessageDigest* CMessageDigestFactory::NewDigestL(CMessageDigest::THashId aHashId)
       
    48 {
       
    49 	CMessageDigest* hash = NULL;
       
    50 	switch (aHashId)
       
    51 	{
       
    52 	case (CMessageDigest::ESHA1):
       
    53 		{
       
    54 			hash = CSHA1Shim::NewL();
       
    55 			break;
       
    56 		}
       
    57 	default:	
       
    58 		User::Leave(KErrNotSupported);
       
    59 	}
       
    60 
       
    61 	return (hash);
       
    62 }
       
    63 
       
    64 CMessageDigest* CMessageDigestFactory::NewDigestLC(CMessageDigest::THashId aHashId)
       
    65 {
       
    66 	CMessageDigest* hash = CMessageDigestFactory::NewDigestL(aHashId);
       
    67 	CleanupStack::PushL(hash);
       
    68 	return (hash);
       
    69 }
       
    70