Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294073

Performance improvement for message digest implementations

XMLWordPrintable

      The performance of message digest implementation could be improved by using improved arithmetic. For example:

                   // ch(x,y,z) = (x and y) xor ((complement x) and z)
      + // = z xor (x and (y xor z));
      - int ch_efg = (e & f) ^ ((~e) & g);
      + int ch_efg = g ^ (e & (f ^ g));
       
                   // maj(x,y,z) = (x and y) xor (x and z) xor (y and z)
      + // = (x and y) xor ((x xor y) and z)
      - int maj_abc = (a & b) ^ (a & c) ^ (b & c);
      + int maj_abc = (a & b) ^ ((a ^ b) & c);

            xuelei Xuelei Fan
            xuelei Xuelei Fan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: