Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Nov 10 19:50:08 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id mAB3o8uX013694 for ; Mon, 10 Nov 2008 19:50:08 -0800 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id mAB3jCh7023440 for ; Mon, 10 Nov 2008 19:45:12 -0800 Message-Id: <200811110345.mAB3jCh7023440@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: SHA1 function returning incorrect hash value Date: Mon, 10 Nov 2008 19:45:12 -0800 From: Bill Cheng Someone wrote: > When I used SHA1() / MD5 function to calculate hash value of a string I do > get incorrect value. Could you give an example? > But if I used *SHA1_Init()*, *SHA1_Update()* and *SHA1_Final()* , > collectively I do get correct hash value ? > Same is the case with MD5. > > What could be the reason for this ? Bugs?! > Or its safe to use *SHA1_Init()*, * > SHA1_Update()* and *SHA1_Final()* functions always ? They are equivalent. For example, in GetUOID(), we call SHA1() directly. It would be an overkill to use SHA1_Init(), SHA1_Update(), and SHA1_Final(). -- Bill Cheng // bill.cheng@usc.edu