1.fas文件称为一种快速加载文件,这种文件省去了加载时的翻译时间,所以相对较快一些.
2.fas文件格式大体如下:
垃圾数据或其他 | fas文件标识 |
data1size ascii) |
‘$’ | data1 不确定是否加密) |
‘$’ | data2size ascii) |
‘$’ | data2 加密) |
keysize 1字节) |
keydata | ‘$’ | 编译时间及其他数据 |
这里面fas文件标识类似 FAS4-FILE ; Do not change it!
python实现:
import os def mixordatapl,mipl): for a in datapl: if lenmipl) < lendatapl)+1: mipl += mipl jiemapl = "" for b in rangelendatapl)): newpl = orddatapl[b]) ^ ordmipl[b]) ^ ordmipl[b+1]) jiemapl += chrnewpl) ret = jiemapl return ret fr = open'acad.fas', 'rb') data = fr.read) fr.close) headflag = 'FAS4-FILE ; Do not change it!' aa = data.findheadflag) ifaa == -1): print 'error in find FAS4' sleep4) data = data[aa-3 : ] i1 = data.find'$') tmp = data[34 : i1] ee = tmp.find' ') tlst = tmp[ : ee] dfg = inttlst) toupl = data[ : i1+1] ifdfg != 1): ee1 = data[34 : i1] i1sta = i1+1 de13 = ee1.find' ') da0lst = ee1[ : de13] num = intda0lst) i1end = i1sta + num i2 = i1end+1 strdat0 = data[i1sta : i1end] tmpl = data[i2 : i2+50] i3 = i2 + tmpl.find'$') + 1; tmpl1 = data[i2+2 : i3] de32 = tmpl1.find' ') da1lst = tmpl1[ : de32] num1 = intda1lst) i3end = i3 + num1 strdat1 = data[i3 : i3end] print i3 keylen = orddata[i3end]) keyend = i3end + keylen + 1 keylst = data[i3end+1 : keyend] lastlst = data[keyend : ] zjlst = data[i2-1 : i3] ## nstrlst0 = mixorstrdat0, keylst) nstrlst1 = mixorstrdat1, keylst) fpl1 = toupl + strdat0 + zjlst + nstrlst1 + strkeylen) + keylst + lastlst fw = open'a11.fas', 'wb') fw.writefpl1) fw.close)
Starry starry night ….