Пример #1
0
def I(x, y, z, r):
  """
  md5 I 'macro'
  x, y, z, r should be registers that are scalars
  puts result in r
  """
  # return y ^ (x | ~z)
  global xcode
  cal.inot(r, z)    # ~z
  cal.ior(r, x, r)  # x | ~z
  cal.ixor(r, y, r) # y ^ (x | ~z)
Пример #2
0
def I(x, y, z, r):
    """
  md5 I 'macro'
  x, y, z, r should be registers that are scalars
  puts result in r
  """
    # return y ^ (x | ~z)
    global xcode
    cal.inot(r, z)  # ~z
    cal.ior(r, x, r)  # x | ~z
    cal.ixor(r, y, r)  # y ^ (x | ~z)
Пример #3
0
def G(x, y, z, r):
    """
  md5 G 'macro'
  x, y, z, r should be registers that are scalars
  puts result in r
  """
    # return (x & z) | (y & ~z)
    global xcode
    temp = xcode.acquire_register()
    cal.iand(r, x, z)  # x & z
    cal.inot(temp, z)  # temp = ~z
    cal.iand(temp, y, temp)  # temp = y & ~z
    cal.ior(r, r, temp)
    xcode.release_register(temp)
Пример #4
0
def F(x, y, z, r):
    """
  md5 F 'macro'
  x, y, z, r should be registers that are scalars
  puts result in r
  """
    # return (x & y) | (~x & z)
    global xcode
    temp = xcode.acquire_register()
    cal.iand(r, x, y)  #  x & y
    cal.inot(temp, x)  # temp = ~x
    cal.iand(temp, temp, z)  # temp = (~x) & z
    cal.ior(r, r, temp)
    xcode.release_register(temp)
Пример #5
0
def G(x, y, z, r):
  """
  md5 G 'macro'
  x, y, z, r should be registers that are scalars
  puts result in r
  """
  # return (x & z) | (y & ~z)
  global xcode
  temp = xcode.acquire_register()
  cal.iand(r, x, z)       # x & z
  cal.inot(temp, z)       # temp = ~z
  cal.iand(temp, y, temp) # temp = y & ~z
  cal.ior(r, r, temp)
  xcode.release_register(temp)
Пример #6
0
def F(x, y, z, r):
  """
  md5 F 'macro'
  x, y, z, r should be registers that are scalars
  puts result in r
  """
  # return (x & y) | (~x & z)
  global xcode
  temp = xcode.acquire_register()
  cal.iand(r, x, y)       #  x & y
  cal.inot(temp, x)       # temp = ~x
  cal.iand(temp, temp, z) # temp = (~x) & z
  cal.ior(r, r, temp)
  xcode.release_register(temp)
Пример #7
0
def FF(a1, b1, c1, d1, x1, s1, ac1):
  global xcode
  l = xcode.acquire_register((ac1, ac1, ac1, ac1))
  temp1 = xcode.acquire_register()
  temp2 = xcode.acquire_register()

  F(b1, c1, d1, temp1)
  cal.iadd(a1, a1, temp1)
  cal.iadd(a1, a1, x1)
  cal.iadd(a1, a1, l)
  
  cal.ishl(temp1, a1, s1)
  cal.ushr(temp2, a1, s1(neg=('x', 'y', 'z', 'w')))
  cal.ior(a1, temp1, temp2)
  cal.iadd(a1, a1, b1)

  xcode.release_register(l)
  xcode.release_register(temp1)
  xcode.release_register(temp2)