Esempio n. 1
0
    def encode(self, object, **kwds):
        szone, pu = self.getparent(szone_t), object.get()
        cookie = szone['cookie'].li.int()

        csum = self.generate_checksum(pu ^ cookie)

        t = bitmap.new(pu, object.size() * 8)
        t = bitmap.rol(t, 4)

        cs = bitmap.new(bitmap.number(t) | csum, bitmap.size(t))
        cs = bitmap.ror(cs, 4)

        logging.info(
            "{:s}.ptr_union.encode : Encoded pointer 0x{:x} with 0x{:x} results in checksum 0x{:x} : {:s}"
            .format(__name__, pu, cookie, csum, bitmap.hex(cs)))

        res = object.copy().set(bitmap.number(cs))
        return super(ptr_union, self).encode(res, **kwds)
Esempio n. 2
0
    def encode(self, object, **kwds):
        szone,pu = self.getparent(szone_t),object.get()
        cookie = szone['cookie'].li.int()

        csum = self.generate_checksum(pu^cookie)

        t = bitmap.new(pu, object.size()*8)
        t = bitmap.rol(t, 4)

        cs = bitmap.new(bitmap.number(t)|csum, bitmap.size(t))
        cs = bitmap.ror(cs, 4)

        logging.info("{:s}.ptr_union.encode : Encoded pointer 0x{:x} with 0x{:x} results in checksum 0x{:x} : {:s}".format(__name__, pu, cookie, csum, bitmap.hex(cs)))

        res = object.copy().set(bitmap.number(cs))
        return super(ptr_union,self).encode(res, **kwds)
Esempio n. 3
0
 def summary(self):
     res = self.bitmap()
     return "{:s} ({:s}, {:d})".format(self.__element__(), bitmap.hex(res),
                                       bitmap.size(res))