Subversion Repositories freemyipod

Rev

Rev 277 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 277 Rev 279
Line 71... Line 71...
71
    return embios.read(0x08000800, len(data) - 0x800)
71
    return embios.read(0x08000800, len(data) - 0x800)
72
 
72
 
73
 
73
 
74
def s5l8702cryptnor(data):
74
def s5l8702cryptnor(data):
75
    data = data.ljust((len(data) + 0xf) & ~0xf, "\0")
75
    data = data.ljust((len(data) + 0xf) & ~0xf, "\0")
76
    header = "87021.0\0\0\0\0\0" + struct.pack("<I", len(data)) + hashlib.sha1(data).digest()[:0x10]
76
    header = "87021.0\x01\0\0\0\0" + struct.pack("<I", len(data)) + hashlib.sha1(data).digest()[:0x10]
77
    embios = libembios.Embios()
77
    embios = libembios.Embios()
78
    embios.write(0x08000000, header.ljust(0x800, "\0") + data)
78
    embios.write(0x08000000, header.ljust(0x800, "\0") + data)
79
    embios.lib.dev.timeout = 20000
79
    embios.lib.dev.timeout = 20000
80
    embios.aesencrypt(0x08000800, len(data), 1)
80
    embios.aesencrypt(0x08000800, len(data), 2)
81
    embios.aesencrypt(0x08000010, 0x10, 1)
81
    embios.aesencrypt(0x08000010, 0x10, 2)
82
    embios.write(0x08000040, hashlib.sha1(embios.read(0x08000000, 0x40)).digest()[:0x10])
82
    embios.write(0x08000040, hashlib.sha1(embios.read(0x08000000, 0x40)).digest()[:0x10])
83
    embios.aesencrypt(0x08000040, 0x10, 1)
83
    embios.aesencrypt(0x08000040, 0x10, 2)
84
    return embios.read(0x08000000, len(data) + 0x800)
84
    return embios.read(0x08000000, len(data) + 0x800)
85
 
85
 
86
 
86
 
87
def s5l8702decryptnor(data):
87
def s5l8702decryptnor(data):
88
    embios = libembios.Embios()
88
    embios = libembios.Embios()