Results 1 to 7 of 7
  1. #1
    java_idiot is offline Member
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    0

    Default [URGENT]SHA Encryption System...need urgent helps

    Hello, everyone

    is there anyone can help me with my project??I'm developing a SHA Encryption System using java. But, I'm facing problems on how to develop it...

    I need helps...

    The system will show SHA Encryption steps by steps...:confused:
    it's a little bit like what is show in this address: My SHA-1 Example

    can anyone help me??PLEASE!!!This is very urgent!!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,305
    Blog Entries
    7
    Rep Power
    20

    Default

    Urgent? On a Sunday? You must be kidding ...

    kind regards,

    Jos

  3. #3
    java_idiot is offline Member
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    0

    Default

    it's very urgent...i try so hard b4 to develop it but end up with nothing..

    need to submit the system this wednesday...:(

  4. #4
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    Quote Originally Posted by java_idiot View Post
    The system will show SHA Encryption steps by steps...:confused: it's a little bit like what is show in this address: My SHA-1 Example

    opening the link and then looking at the source code of the html page you can see the javascript code that have been used for the SHA-1 example. do you have problems translating the code from javascript to java? and can you please post the java code you have till now. there is no "little bit like": either your code act equals like SHA-1 or you specify what you want.
    Last edited by j2me64; 04-18-2010 at 09:30 AM.

  5. #5
    java_idiot is offline Member
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    0

    Default

    do you have problems translating the code from javascript to java?
    yes...i have the problems translating the code frm js to java...

    but, there is a little error in this page also...

    I need to develop SHA Encryption System that shows the steps of encrypting the data using SHA algorithm...the pseudocode can be found in this address: http://sammisoft.net/mboard/mboard/m...&order_da=desc

    I don't know how to do these parts:
    • append the bit '1' to the message
    • append 0 ≤ k < 512 bits '0', so that the resulting message length (in bits) is congruent to 448 ≡ −64 (mod 512)
    • append length of message (before pre-processing), in bits, as 64-bit big-endian integer
    • break message into 512-bit chunks
    • for each chunk:
      break chunk into sixteen 32-bit big-endian words w[i], 0 ≤ i ≤ 15
    • Extend the sixteen 32-bit words into eighty 32-bit words:
      for i from 16 to 79
      w[i] = (w[i-3] xor w[i-8] xor w[i-14] xor w[i-16]) leftrotate 1


    I use netbeans ide 6.8 to develop this system
    I will show my coding in next post...

  6. #6
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    Look at RhinoScript. It's a plugin available to run JavaScript as Java using the JS code as a string and parsing it into a .java file
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  7. #7
    java_idiot is offline Member
    Join Date
    Mar 2010
    Posts
    7
    Rep Power
    0

    Default

    I don't know y i can't get the output same as the output in this address: My SHA-1 Example

    :confused:

    my coding is as follow:
    • ChoicesAndMessage.java


    import javax.swing.JOptionPane;
    import SHA1.InitialHash;
    import SHA1.Words;
    import SHA1.calcHash;

    public class ChoicesAndMessage extends javax.swing.JFrame {
    shaEncrypt sha = new shaEncrypt();
    Result shaOutput = new Result();
    calcHash sha1Hash = new calcHash();
    sha256calcHash s2Hash = new sha256calcHash();
    String hex2, bin2;
    String padBin, padHex, padHex2;
    int count0,m_Len;
    String padHexArray[];
    long words[] = new long[80];
    long s2Words[] = new long[64];
    long s5Words[] = new long[80];
    long s2K[] = new long [64];
    long sha1HV[] = new long[80];
    String shaWords[] = new String[80];
    String s2w[] = new String[64];
    String s5w[] = new String[80];
    long a[] = new long[80];
    long b[] = new long[80];
    long c[] = new long[80];
    long d[] = new long[80];
    long e[] = new long[80];
    String Hash[] = new String[80];

    /** Creates new form ChoicesAndMessage */
    public ChoicesAndMessage() {
    initComponents();
    }

    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

    cbSelection = new javax.swing.JComboBox();
    jLabel1 = new javax.swing.JLabel();
    jScrollPane1 = new javax.swing.JScrollPane();
    txtMessage = new javax.swing.JTextPane();
    btnEncrypt = new javax.swing.JButton();
    btnClear = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
    setTitle("SHA Encryption System_Choices and Message");
    setName("Choices and Message"); // NOI18N

    cbSelection.setFont(new java.awt.Font("Tahoma", 0, 12));
    cbSelection.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Please select a SHA Algorithm", "SHA-1", "SHA-256", "SHA-512" }));
    cbSelection.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    cbSelectionActionPerformed(evt);
    }
    });

    jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12));
    jLabel1.setText("Message to be encrypted:");

    txtMessage.setEnabled(false);
    jScrollPane1.setViewportView(txtMessage);

    btnEncrypt.setFont(new java.awt.Font("Tahoma", 0, 12));
    btnEncrypt.setText("Encrypt");
    btnEncrypt.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnEncryptActionPerformed(evt);
    }
    });

    btnClear.setFont(new java.awt.Font("Tahoma", 0, 12));
    btnClear.setText("Clear");
    btnClear.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btnClearActionPerformed(evt);
    }
    });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(105, 105, 105)
    .addComponent(cbSelection, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE))
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jLabel1)))
    .addContainerGap())
    .addGroup(layout.createSequentialGroup()
    .addGap(123, 123, 123)
    .addComponent(btnEncrypt)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.UNRELATED)
    .addComponent(btnClear, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
    .addGap(154, 154, 154))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(31, 31, 31)
    .addComponent(cbSelection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(23, 23, 23)
    .addComponent(jLabel1)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.RELATED)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.Component Placement.UNRELATED)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    .addComponent(btnEncrypt)
    .addComponent(btnClear))
    .addContainerGap(javax.swing.GroupLayout.DEFAULT_S IZE, Short.MAX_VALUE))
    );

    pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed
    // TODO add your handling code here:
    txtMessage.setText("");
    }//GEN-LAST:event_btnClearActionPerformed

    private void cbSelectionActionPerformed(java.awt.event.ActionEv ent evt) {//GEN-FIRST:event_cbSelectionActionPerformed
    // TODO add your handling code here:
    if (cbSelection.getSelectedIndex()== 0)
    {
    txtMessage.setEnabled(false);
    }
    else
    {
    txtMessage.setEnabled(true);
    }
    }//GEN-LAST:event_cbSelectionActionPerformed

    private void btnEncryptActionPerformed(java.awt.event.ActionEve nt evt) {//GEN-FIRST:event_btnEncryptActionPerformed
    // TODO add your handling code here:

    String message = txtMessage.getText();


    if (cbSelection.getSelectedIndex() == 0)
    {
    JOptionPane.showMessageDialog(null, "Please select a SHA Algorithm","No Selection Made",JOptionPane.WARNING_MESSAGE);
    }
    else if (cbSelection.getSelectedIndex() == 1)
    {
    Words sha1Words = new Words();
    shaOutput.txtResults.append("<<< Initialize variables >>>\n");
    shaOutput.txtResults.append("H0: "+Integer.toHexString(InitialHash.h0).toUpperCase( ));
    shaOutput.txtResults.append("\nH1: "+Integer.toHexString(InitialHash.h1).toUpperCase( ));
    shaOutput.txtResults.append("\nH2: "+Integer.toHexString(InitialHash.h2).toUpperCase( ));
    shaOutput.txtResults.append("\nH3: "+Integer.toHexString(InitialHash.h3).toUpperCase( ));
    shaOutput.txtResults.append("\nH4: "+Integer.toHexString(InitialHash.h4).toUpperCase( )+ "\n\n");
    shaOutput.txtResults.append("<<< Message Padding >>>\n");
    shaOutput.txtResults.append("-->Append '1' to message\n");
    shaOutput.txtResults.append("-->Append 0<=k<=512 '0's to message\n");
    shaOutput.txtResults.append("-->Append length of message in bits\n");

    if(message.length()== 0)
    {
    int reply = JOptionPane.showConfirmDialog(null, "The message field is left blank.\nThe system will continue with Message Padding process ! ! !\nClick Yes if you wish to continue, No to stay remain on this page...", "Message Field Left Blank", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);

    if(reply == JOptionPane.YES_OPTION){
    //sha.setMessage(message);
    shaOutput.txtM_Hex.setText("No message to be encrypted...");
    shaOutput.txtM_Bin.setText("No message to be encrypted...");
    padBin = "1";
    bin2 = padBin;
    while (bin2.length()!=512)
    {
    padBin = "0";
    bin2 = bin2+padBin;
    count0 += padBin.replaceAll("[^0]","").length();
    }
    shaOutput.txtResults.append("No of '0's padded: "+Integer.toString(count0));

    shaOutput.txtResults.append("\nPadded Message (in Binary): \n");

    char afterPaddingBin [] = new char[bin2.length()];

    afterPaddingBin = bin2.toCharArray();
    int count = 1;
    for(int i=0; i<bin2.length(); i++){
    shaOutput.txtResults.append(""+afterPaddingBin[i]);
    if(count%8==0){
    shaOutput.txtResults.append(" ");
    }
    count++;
    }
    String sub;
    String isub;
    int sub2;
    shaOutput.txtResults.append("\n\nPadded Message (in Hexadecimal): \n");

    for (int i=0; i<bin2.length(); i+=8)
    {
    sub = bin2.substring(i,i+8);
    sub2 = Integer.parseInt(sub,2);
    isub = Integer.toHexString(sub2);
    if (isub.length() == 1)
    {
    isub = "0"+isub;
    }
    padHex += isub;
    padHex = padHex.replaceAll("null", "");
    }

    char afterPaddingHex [] = new char[padHex.length()];
    afterPaddingHex = padHex.toCharArray();
    for(int i=0; i<padHex.length(); i++){

    padHex2 += afterPaddingHex[i];
    if(count%8==0){
    padHex2 = padHex2+" ";
    }
    count++;
    padHex2 = padHex2.replaceAll("null", "");
    }
    shaOutput.txtResults.append(padHex2);
    words = sha.getWords();
    shaOutput.txtResults.append("\n<<< Words >>>");
    for (int i=0; i<80; i++)
    {
    words = sha1Words.words(padHex2);

    shaWords[i] = Long.toHexString(words[i]).toUpperCase();
    while (shaWords[i].length()<8)
    {
    shaWords[i]="0"+shaWords[i];
    }
    if(shaWords[i].length()>8){
    int xtra = shaWords[i].length() - 8;
    shaWords[i]=shaWords[i].substring(xtra, shaWords[i].length());
    }
    shaOutput.txtResults.append("\nWord["+i+"]:"+shaWords[i]);
    Hash = sha1Hash.doHash(words);
    shaOutput.setVisible(true);
    setVisible(false);


    }


    }else{
    if(message.length()==0){
    txtMessage.requestFocusInWindow();
    }
    }
    }

    else if (message.length()>55)
    {
    JOptionPane.showMessageDialog(null, "Message entered is too long","Message exceeds limit length",JOptionPane.WARNING_MESSAGE);
    txtMessage.requestFocusInWindow();
    txtMessage.selectAll();
    }

    else
    {
    shaOutput.txtM_Hex.setText("");
    for (int i=0; i< message.length(); i++)
    {
    char c = message.charAt(i);
    int j = (int)c;
    String hex = Integer.toHexString(j);
    String bin = Integer.toBinaryString(j);
    hex2 += hex + " ";
    hex2 = hex2.replaceAll("null", "");
    while (bin.length()<8)
    {
    bin = "0" + bin;
    bin2 += bin;
    }
    bin2 = bin2 + " ";
    bin2 = bin2.replaceAll("null", "");
    shaOutput.txtM_Hex.setText(hex2);
    shaOutput.txtM_Bin.setText(bin2);
    m_Len = message.length()*8;
    shaOutput.txtM_Len.setText(Integer.toString(m_Len) );
    }
    bin2 = bin2.replaceAll(" ", "");
    bin2 = bin2 +"1";
    while (bin2.length()<(448))
    {
    padBin = "0";
    bin2 = bin2+padBin;
    count0 += padBin.replaceAll("[^0]","").length();
    }
    shaOutput.txtResults.append("\nNo of '0's padded: "+Integer.toString(count0));
    String mLenBin = Integer.toBinaryString(m_Len);
    while (mLenBin.length()<64)
    {
    mLenBin = "0"+mLenBin;
    }
    bin2 = bin2+mLenBin;
    shaOutput.txtResults.append("\nPadded Message (in Binary): \n");
    char afterPaddingBin [] = new char[bin2.length()];

    afterPaddingBin = bin2.toCharArray();
    int count = 1;
    for(int i=0; i<bin2.length(); i++){
    shaOutput.txtResults.append(""+afterPaddingBin[i]);
    if(count%8==0){
    shaOutput.txtResults.append(" ");
    }
    count++;
    }
    String sub;
    String isub;
    int sub2;
    shaOutput.txtResults.append("\n\nPadded Message (in Hexadecimal): \n");

    for (int i=0; i<bin2.length(); i+=8)
    {
    sub = bin2.substring(i,i+8);
    sub2 = Integer.parseInt(sub,2);
    isub = Integer.toHexString(sub2);
    if (isub.length() == 1)
    {
    isub = "0"+isub;
    }
    padHex += isub;
    padHex = padHex.replaceAll("null", "");
    }

    char afterPaddingHex [] = new char[padHex.length()];
    afterPaddingHex = padHex.toCharArray();
    for(int i=0; i<padHex.length(); i++){

    padHex2 += afterPaddingHex[i];
    if(count%8==0){
    padHex2 = padHex2+" ";
    }
    count++;
    padHex2 = padHex2.replaceAll("null", "");
    }
    shaOutput.txtResults.append(padHex2);
    words = sha.getWords();



    for (int i=0; i<80; i++)
    {
    words = sha1Words.words(padHex2);
    Hash = sha1Hash.doHash(words);
    shaWords[i] = Long.toHexString(words[i]).toUpperCase();
    while (shaWords[i].length()<8)
    {
    shaWords[i]="0"+shaWords[i];
    }
    if(shaWords[i].length()>8){
    int xtra = shaWords[i].length() - 8;
    shaWords[i]=shaWords[i].substring(xtra, shaWords[i].length());
    }
    shaOutput.txtResults.append("\nWord["+i+"]:"+shaWords[i]);


    }
    shaOutput.setVisible(true);
    }
    }
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new ChoicesAndMessage().setVisible(true);
    }
    });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnClear;
    public javax.swing.JButton btnEncrypt;
    public javax.swing.JComboBox cbSelection;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    public javax.swing.JTextPane txtMessage;
    // End of variables declaration//GEN-END:variables

    }



    • InitialHash.java

    public class InitialHash {

    public static int h0 = 0x67452301;
    public static int h1 = 0xefcdab89;
    public static int h2 = 0x98badcfe;
    public static int h3 = 0x10325476;
    public static int h4 = 0xc3d2e1f0;

    }

    • Words.java

    import Main.shaEncrypt;

    public class Words {

    long words1[]= new long[64];
    long words2[] = new long[64];
    long words[] = new long[80];
    String sha1Words[] = new String[80];
    public String[] msg;
    long msg1[] = new long[16];
    String w[];
    shaEncrypt sha = new shaEncrypt();
    public long[] words(String padHex2)
    {
    msg = padHex2.split(" ");
    for (String a: msg)
    {
    System.out.println(a);
    }

    for (int i=0; i<80; i++)
    {
    if(i < 16)
    {
    msg1[i] = Long.parseLong(msg[i],16);
    words[i] = msg1[i];
    sha1Words[i] = Long.toHexString(words[i]);
    while (sha1Words[i].length()<8)
    {
    sha1Words[i]="0"+sha1Words[i];
    }
    System.out.println("w["+i+"]: " +sha1Words[i]);
    }


    else if (i >= 16 && i<80)
    {
    int count = 0;
    words1[count]= words[i-3]^words[i-8]^words[i-14]^words[i-16];
    String binWords = Long.toBinaryString(words1[count]);
    while (binWords.length()< 32)
    {
    binWords = "0" + binWords;
    }
    if (binWords.length()>32)
    {
    int xtra = binWords.length()-32;
    binWords = binWords.substring(xtra, binWords.length());
    }

    words1[count] = Long.parseLong(binWords,2);
    words2[count]= words1[count]<<1|words1[count]>>>31;

    words[i] = words2[count];
    sha1Words[i] = Long.toHexString(words[i]);
    while (sha1Words[i].length()<8)
    {
    sha1Words[i]="0"+sha1Words[i];
    }
    if(sha1Words[i].length()>8){
    int j = sha1Words[i].length() - 8;
    sha1Words[i]=sha1Words[i].substring(j, sha1Words[i].length());

    }

    System.out.println("w["+i+"]: " +sha1Words[i]);

    count++;

    }
    }

    sha.setWords(words);


    return words;
    }

    }

    • calcHash.java

    public class calcHash {


    Functions funcs = new Functions();
    shaEncrypt sha = new shaEncrypt();
    long temp[] = new long[81];
    int i;
    long h0,h1,h2,h3,h4;
    String hashV[] = new String[80];
    String digest;
    long a[] = new long[81];
    long b[] = new long[81];
    long c[] = new long[81];
    long d[] = new long[81];
    long e[] = new long[81];
    //long w[] = new long[80];
    long func[] = new long[81];
    String wordHex[] = new String[80];


    public String[] doHash(long []w)
    {

    a[0]=InitialHash.h0;
    b[0]=InitialHash.h1;
    c[0]=InitialHash.h2;
    d[0]=InitialHash.h3;
    e[0]=InitialHash.h4;
    for (i=0; i<80; i++)
    {
    if (i<20)
    {


    func[i] = (b[i]&c[i])|((~b[i])&d[i]);
    int K = 1518500249;

    temp[i+1] = (a[i]<<5|a[i]>>>27)+func[i]+e[i]+w[i]+K;
    e[i+1]=d[i];
    d[i+1]=c[i];
    c[i+1]=((b[i]<< 30)|(b[i]>>> 32));
    b[i+1]=a[i];
    a[i+1]=temp[i+1];

    System.out.println("func============="+Long.toHexS tring(func[i]));
    hashV[i] = "A = ["+i+"]:"+Long.toHexString(a[i+1])+"\tB = "+Long.toHexString(b[i+1])+"\tC = "+Long.toHexString(c[i+1])+"\tD = "+Long.toHexString(d[i+1])+"\tE = "+Long.toHexString(e[i+1]);
    System.out.println(hashV[i]);

    }

    else if (i >= 20 &&i<40)
    {
    func[i] = b[i]^c[i]^d[i];
    int K = 1859775393;
    temp[i+1] = (a[i]<<5|a[i]>>>27)+func[i]+e[i]+w[i]+K;
    e[i+1]=d[i];
    d[i+1]=c[i];
    c[i+1]=(b[i]<< 30);
    b[i+1]=a[i];
    a[i+1]=temp[i+1];

    System.out.println("func============="+func[i]);
    hashV[i] = "A = "+Long.toHexString(a[i+1])+"B = "+Long.toHexString(b[i+1])+"C = "+Long.toHexString(c[i+1])+"D = "+Long.toHexString(d[i+1])+"E = "+Long.toHexString(e[i+1]);
    System.out.println(hashV[i]);
    }

    else if (i >= 40&& i<60)
    {
    func[i] = (b[i]&c[i])|(b[i]&d[i])|(c[i]&d[i]);
    int K = -1894007588;
    temp[i+1] = (a[i]<<5|a[i]>>>27)+func[i]+e[i]+w[i]+K;
    e[i+1]=d[i];
    d[i+1]=c[i];
    c[i+1]=(b[i]<< 30);
    b[i+1]=a[i];
    a[i+1]=temp[i+1];

    System.out.println("func============="+func[i]);

    hashV[i+1] = "A = "+Long.toHexString(a[i+1])+"B = "+Long.toHexString(b[i+1])+"C = "+Long.toHexString(c[i+1])+"D = "+Long.toHexString(d[i+1])+"E = "+Long.toHexString(e[i+1]);
    System.out.println(hashV[i]);
    }

    else if (i >= 60&& i<80)
    {
    func[i] = b[i]^c[i]^d[i];
    int K = -899497514;
    temp[i+1] = (a[i]<<5|a[i]>>>27)+func[i]+e[i]+w[i]+K;
    e[i+1]=d[i];
    d[i+1]=c[i];
    c[i+1]=(b[i]<< 30);
    b[i+1]=a[i];
    a[i+1]=temp[i+1];

    System.out.println("func============="+func[i]);
    hashV[i] = "A = ["+i+"]:"+Long.toHexString(a[i+1])+"B = "+Long.toHexString(b[i+1])+"C = "+Long.toHexString(c[i+1])+"D = "+Long.toHexString(d[i+1])+"E = "+Long.toHexString(e[i+1]);
    System.out.println(hashV[i]);
    }

    h0=InitialHash.h0;
    h1=InitialHash.h1;
    h2=InitialHash.h2;
    h3=InitialHash.h3;
    h4=InitialHash.h4;
    h0 += a[79];
    h1 += b[79];
    h2 += c[79];
    h3 += d[79];
    h4 += e[79];
    }

    //System.out.println(Long.toHexString(h0)+" "+h1+" "+h2+" "+h3+" "+h4);

    sha.setH0(h0);
    sha.setH1(h1);
    sha.setH2(h2);
    sha.setH3(h3);
    sha.setH4(h4);

    digest = Long.toHexString(h0) + " "+Long.toHexString(h1)+" "+Long.toHexString(h2)+" "+Long.toHexString(h3)+" "+Long.toHexString(h4);
    sha.setDigest(digest);
    System.out.println("Message digest: "+digest);
    return hashV;
    }

    }


    **I think the problems are at calcHash.java
    But, I don't know what are wrong...the Hash values are not the same as in My SHA-1 Example :(

Similar Threads

  1. Identifying System Architecture-Urgent
    By Robert_85 in forum Advanced Java
    Replies: 2
    Last Post: 08-16-2009, 04:34 AM
  2. Very very URGENT: Concurrent versioning system
    By antest07 in forum Eclipse
    Replies: 0
    Last Post: 03-31-2009, 07:38 AM
  3. Urgent help
    By tiger100plus in forum New To Java
    Replies: 3
    Last Post: 12-09-2008, 05:10 AM
  4. need urgent help...
    By SCS17 in forum New To Java
    Replies: 1
    Last Post: 11-13-2007, 07:52 AM
  5. Urgent-Imp-Displaying message with respect to system time
    By garinapavan in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •