# Path: sippy/Time/clock_dtime.py
# def clock_getntime(type):
#     ts = clock_getitime(type)
#     return (ts[0] * 10**9 + ts[1])
# 
# CLOCK_MONOTONIC = 4 # see <linux/time.h> / <include/time.h>


from base64 import b64encode, b64decode
from Crypto import Random
from Crypto.Cipher import AES
from sippy.Time.clock_dtime import clock_getntime, CLOCK_MONOTONIC
    from threading import Thread
            from time import sleep
        iv = Random.new().read(AES.block_size)
        raw = bxor(raw, iv)
        eraw = self.cipher.encrypt(iv + raw)
        return b64encode(eraw)[:-1]

    def decrypt(self, enc):
        enc = b64decode(enc + self.bpad)
        raw = self.cipher.decrypt(enc)
        iv = raw[:AES.block_size]
        return bxor(raw[AES.block_size:], iv)

DGST_MD5        = (1 << 0)
DGST_MD5SESS    = (1 << 1)
DGST_SHA256     = (1 << 2)
DGST_SHA256SESS = (1 << 3)
DGST_SHA512     = (1 << 4)
DGST_SHA512SESS = (1 << 5)

DGST_PRIOS = (DGST_SHA512, DGST_SHA512SESS, DGST_SHA256, DGST_SHA256SESS, DGST_MD5, DGST_MD5SESS)

class HashOracle(object):
    try: key
    except: key = Random.new().read(AES.block_size * 2)
    ac = None
    vtime = 32 * 10**9

    def __init__(self):
        self.ac = AESCipher(self.key)

    def emit_challenge(self, cmask):

# Path: sippy/Time/clock_dtime.py
# def clock_getntime(type):
#     ts = clock_getitime(type)
#     return (ts[0] * 10**9 + ts[1])
# 
# CLOCK_MONOTONIC = 4 # see <linux/time.h> / <include/time.h>


# Path: sippy/Security/SipNonce.py
from base64 import b64encode, b64decode
from Crypto import Random
from Crypto.Cipher import AES
from sippy.Time.clock_dtime import clock_getntime, CLOCK_MONOTONIC
    from threading import Thread
            from time import sleep

        iv = Random.new().read(AES.block_size)
        raw = bxor(raw, iv)
        eraw = self.cipher.encrypt(iv + raw)
        return b64encode(eraw)[:-1]

    def decrypt(self, enc):
        enc = b64decode(enc + self.bpad)
        raw = self.cipher.decrypt(enc)
        iv = raw[:AES.block_size]
        return bxor(raw[AES.block_size:], iv)

DGST_MD5        = (1 << 0)
DGST_MD5SESS    = (1 << 1)
DGST_SHA256     = (1 << 2)
DGST_SHA256SESS = (1 << 3)
DGST_SHA512     = (1 << 4)
DGST_SHA512SESS = (1 << 5)

DGST_PRIOS = (DGST_SHA512, DGST_SHA512SESS, DGST_SHA256, DGST_SHA256SESS, DGST_MD5, DGST_MD5SESS)

class HashOracle(object):
    try: key
    except: key = Random.new().read(AES.block_size * 2)
    ac = None
    vtime = 32 * 10**9

    def __init__(self):
        self.ac = AESCipher(self.key)

    def emit_challenge(self, cmask):

        ts128 = clock_getntime(CLOCK_MONOTONIC) << len(DGST_PRIOS)