[[PageOutline(2, Programming Languages)]] These snippets should be useful to read RAR archives with store compression (which means none compression is used). Feel free to edit/add source-codes if you have faster/better/new language implementation. Links: * http://www.unrarlib.org/ * http://www.rarlab.com/rar_add.htm * http://github.com/jphastings/unrar/ (in Ruby) == Python == {{{ #(c)Kamil DziĆ³bek turbos11(at)gmail.com # BSD License from struct import * def getlastsplit(firsrarfile,x): if firsrarfile[-3:]=='001': return firsrarfile[:-3]+('%03d' %(x+1)) if firsrarfile[-11:-6]=='.part': return firsrarfile[0:-6]+('%02d' % (x+1))+firsrarfile[-4:] if firsrarfile[-10:-5]=='.part': return firsrarfile[0:-5]+('%1d' % (x+1))+firsrarfile[-4:] return firsrarfile[0:-2]+('%02d' %(x-1) ) def addfilehash(name,hash,seek): f=open(name, 'rb') f.seek(seek) for i in range(8192): hash+=unpack(' (size,hash)""" if not(firsrarfile.lower().endswith('.rar') | firsrarfile.endswith('.001')): raise Exception('Bad file suffix. Only .rar and .001 support.') if firsrarfile[-11:-6]=='.part': firsrarfile=firsrarfile[0:-6]+'01'+firsrarfile[-4:] f=open(firsrarfile, 'rb') a=f.read(4) if a!='Rar!': raise Exception('ERROR: This is not rar file.') seek=0 for i in range(4): f.seek(seek) a=f.read(100) type,flag,size=unpack( ' (size,hash) def OpensubtitlesHashRar(firsrarfile) raise 'Bad file suffix. Only .rar and .001 support.' unless firsrarfile.downcase =~ /\.rar$/ || firsrarfile =~ /\.001$/ firsrarfile = firsrarfile[0..-6] + '01' + firsrarfile[-4..-1] if firsrarfile[-11..-6] == '.part' f = File.open(firsrarfile, 'rb') a = f.read(4) raise 'ERROR: This is not rar file.' if a != 'Rar!' seek = 0 4.times do |i| f.seek(seek) a = f.read(100) type, flag, size = a[2..7].unpack('Cvv') puts [type, flag, size].inspect if 0x74 == type raise 'Bad compression method! Work only for "store".' if 0x30 != a[25..26].unpack('C')[0] s_partiizebodystart = seek + size s_partiizebody, s_unpacksize = a[7..15].unpack('