Return-Path: Delivered-To: apmail-jakarta-jmeter-user-archive@www.apache.org Received: (qmail 33113 invoked from network); 20 Nov 2010 19:17:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Nov 2010 19:17:03 -0000 Received: (qmail 78784 invoked by uid 500); 20 Nov 2010 19:17:34 -0000 Delivered-To: apmail-jakarta-jmeter-user-archive@jakarta.apache.org Received: (qmail 78748 invoked by uid 500); 20 Nov 2010 19:17:34 -0000 Mailing-List: contact jmeter-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "JMeter Users List" Reply-To: "JMeter Users List" Delivered-To: mailing list jmeter-user@jakarta.apache.org Received: (qmail 78739 invoked by uid 99); 20 Nov 2010 19:17:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Nov 2010 19:17:33 +0000 X-ASF-Spam-Status: No, hits=3.5 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of shettyd@gmail.com designates 209.85.214.172 as permitted sender) Received: from [209.85.214.172] (HELO mail-iw0-f172.google.com) (209.85.214.172) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Nov 2010 19:17:27 +0000 Received: by iwn40 with SMTP id 40so6575688iwn.31 for ; Sat, 20 Nov 2010 11:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=cQXzrznBKZ9eRlfLGNhMLFj1BzbZFpCB7Sjj5OTbc9M=; b=X9LTVOwsr/fD0jMANazue4cM4xmyNynMF3bvC+qlsH2on9Z4sbwR76bPKxX8YrIpv6 MEtRhL8etu4ZZOzggwrWv2FqMxCKMlNqPC3HjJRoxBIJfQTi/RAwwfShi+JH2tgDglMf lsoDeX8S6/Uchq9UvITXkclg42JVNWa2XAens= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=vvCKvytDU95y+suvm0JIUujO/ugWy6Hfn2O2ZkMmxpnBMXMaQkr0hFYT7wy5Ab8yy7 DP32mB45C89Kp01+hyQmlMx5oImo5vIcbKXncwRm086BH/eBU612sVDfWaoryDD8iSid 5kfmZPqX+duV7FOhh1vhNLuh/r7yMRV/vnMhw= MIME-Version: 1.0 Received: by 10.231.14.135 with SMTP id g7mr4030691iba.106.1290280623651; Sat, 20 Nov 2010 11:17:03 -0800 (PST) Received: by 10.231.79.134 with HTTP; Sat, 20 Nov 2010 11:17:03 -0800 (PST) In-Reply-To: <1290264513188-3273660.post@n5.nabble.com> References: <1290215661235-3273251.post@n5.nabble.com> <1290264513188-3273660.post@n5.nabble.com> Date: Sat, 20 Nov 2010 11:17:03 -0800 Message-ID: Subject: Re: Need helping creating a md5 hash From: Deepak Shetty To: JMeter Users List Content-Type: multipart/alternative; boundary=00221534d6cb3bbdca049580dedf X-Virus-Checked: Checked by ClamAV on apache.org --00221534d6cb3bbdca049580dedf Content-Type: text/plain; charset=ISO-8859-1 >vars.put("stimehash",md5hash); vars.put expects a string as the value , not a byte[] . You have to use vars.putObject("stimehash",md5hash); However if you intend using this in any following HTTPSampler then you need to figure out what the String representation is (some people convert the byte[] array into a hex string , some convert into a BigInteger or something like that regards deepak On Sat, Nov 20, 2010 at 6:48 AM, 5942marine wrote: > > Thanks Deepak for the quick reply. > > This is what I put into my Beanshell Pre- Processor > > import java.security.MessageDigest; > String text = vars.get("time") > MessageDigest md = MessageDigest.getInstance("MD5"); > byte[] md5hash = new byte[32]; > md.update(text.getBytes("utf-8"), 0, text.length()); > md5hash = md.digest(); > vars.put("stimehash",md5hash); > > Now, I have just a few questions. The paramater time is what I'm trying to > hash. I believe I have the correct. But in the beanshell on the top, theirs > a field: > > Parameters to be passed to beanshell... > > I assume I need to put in the parameter from my previous regex correct, > which is "time" > > Secondly, after running, I got the followin in my jmeter.log > > 2010/11/20 07:38:25 ERROR - jmeter.util.BeanShellInterpreter: Error > invoking > bsh method: eval In file: inline evaluation of: ``import > java.security.MessageDigest; String text = vars.get("time") MessageDiges . > . > . '' Encountered "MessageDigest" at line 3, column 1. > > And lastly, the last line of the beanshell, I have the vars.put..., Which I > assume is the correct way to create a new paramater that I can reference, > since I need to keep the original value of the paramater time. > > Again, thanks for all your help! > -- > View this message in context: > http://jmeter.512774.n5.nabble.com/Need-helping-creating-a-md5-hash-tp3273251p3273660.html > Sent from the JMeter - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org > > --00221534d6cb3bbdca049580dedf--