View Single Post
Old 08-23-2012, 03:30 AM   #36
ixtab
(offline)
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,907
Karma: 6736094
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by geekmaster View Post
EDIT: Again, I do not know how the kindle DRM does it. I suspect that generating keys for all possible kindle serial numbers would be very slow. Using a fast hash for key generation would be vulnerable to brute-forcing the much smaller serial-number space instead of the full 12-bit encryption keyspace, so it would be foolish to use a fast hash for DRM key generation. After you have the right key, decryption is fast. But FINDING the right key is slow, which is why you need to know the serial number of the kindle that owns the DRMed media, or otherwise extract its key from it.
So, I just tried it. This is the result of a quick & dirty test, using the actual implementation that is running on the Kindle. In fact, the search space is even less, it actually only consists of seven alphanumeric characters. Testing 1,000,000 different keys takes about 35 seconds - and that is completely unoptimized code, which can certainly be made faster by at least an order of magnitude.

So if I was using that unoptimized program to brute-force the key for a book, it would take pretty much exactly one month to go through the entire keyspace. Parallelize this to 100 quad-core machines using AWS, and you have it cracked in at most 2 hours.

Spoiler:

DEBUG>pdbName : ;modificationDate :1311982001;type :1112493899;creator :1297039945
DEBUG>wVersion : 17480; dwStoryLen :120547861; wNumRecs :29755; wRecSize :4096; wSpare2 :2
DEBUG>magic : 1297039945; hsize :232; type :1112493899; content_type :2; encoding :1252:1252; random_id :2081344976; version :6
DEBUG>Index :29757 29833 29836 -1 -1 -1 -1 29838 -1 -1 29757
DEBUG>titleOffset :1324; title_len :28; title :; minVersion:6; embedBase:29864
DEBUG>Huffman : hufdic : 29840; hufdiclen :24; absTable :30083; tableLen:2
DEBUG>New big title :Oxford Dictionary of English
DEBUG>FFV4: idx_slaves :-1; voucherOffset :1036; voucher_tblen :1; voucher_len :288; flow_count :77
ERROR>Wrong trailingByteTypes
DEBUG>header FFV6, idx=-1
DEBUG> This book was FFV :6

1000000 iterations took 34734 ms

ixtab is offline   Reply With Quote