public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "ovidr at users dot sourceforge dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/17903] New: Incorrect SHA result
Date: Sat, 09 Oct 2004 04:02:00 -0000 [thread overview]
Message-ID: <20041009040243.17903.ovidr@users.sourceforge.net> (raw)
gcc version 4.0.0 20040922 (experimental)
gcj --main=shatest shatest.java
> ./a.out
84983E441C3BD26EBAAE4AA1F95129E5E54670F1
4C39C6859F663A6B98679AD874DD60AD98D83700
NOT EQUAL!
They are equal in sun's java, and gcc 3.4.0
import java.security.*;
class shatest {
public static void main(String[] argv) {
MessageDigest md=null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (Exception e) {
e.printStackTrace();
}
md.update
("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq".getBytes(), 0, 56);
String exp = "84983E441C3BD26EBAAE4AA1F95129E5E54670F1";
String result = toString(md.digest());
System.out.println(exp);
System.out.println(result);
if (!exp.equals(result))
System.out.println("NOT EQUAL!");
}
public static String toString(byte[] ba) {
return toString(ba, 0, ba.length);
}
public static final String toString(byte[] ba, int offset, int length) {
char[] buf = new char[length * 2];
for (int i = 0, j = 0, k; i < length; ) {
k = ba[offset + i++];
buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];
buf[j++] = HEX_DIGITS[ k & 0x0F];
}
return new String(buf);
}
private static final char[] HEX_DIGITS = "0123456789ABCDEF".toCharArray();
}
--
Summary: Incorrect SHA result
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ovidr at users dot sourceforge dot net
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17903
next reply other threads:[~2004-10-09 4:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-09 4:02 ovidr at users dot sourceforge dot net [this message]
2004-10-09 4:11 ` [Bug libgcj/17903] " pinskia at gcc dot gnu dot org
2004-10-09 7:38 ` andreast at gcc dot gnu dot org
2004-10-09 15:45 ` ovidr at users dot sourceforge dot net
2004-10-12 10:13 ` cvs-commit at gcc dot gnu dot org
2004-10-18 4:37 ` pinskia at gcc dot gnu dot org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041009040243.17903.ovidr@users.sourceforge.net \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=java-prs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).