Copy link to clipboard
Copied
Hello all,
I was wondering if anyone could tell me how to find the file size in the swf header. I am looking at the swf file format spec v10 pdf and it says that “The FileLength field is the total length of the SWF file, including the header. If this is an
uncompressed SWF file (FWS signature), the FileLength field should exactly match the file
size. If this is a compressed SWF file (CWS signature), the FileLength field indicates the total
length of the file after decompression, and thus generally does not match the file size. Having
the uncompressed size available can make the decompression process more efficient.”
Only problem is I can’t find this.
If I were to look at the hex value of a swf what would I look for to find the file size?
Here is the file:
465753095f030000780007d00000177000001201004411000000004302ffffff3f0335030000886a01250050524553454e54535452494e470041314c310050524553454e5450415448002e2e2f416e6e657820412f004c4553534f4e535452494e470052534c30313032004c4553534f4e50415448002e2e2f6c6573736f6e732f007373436f726500696e69740050524553454e54464f4c444552002f006c617374496e6465784f6600696e6465784f6600737562737472696e67006c6573736f6e4c697374656e6572004f626a656374006f6e4c6f6164496e697400706173736564496e3100706173736564496e32006d61696e006c6573736f6e4c6f61646572004d6f766965436c69704c6f61646572006164644c697374656e6572006765744e657874486967686573744465707468006c6573736f6e007468697300637265617465456d7074794d6f766965436c69700073796e630070617468007373476c6f62616c730073734261736550617468005c00417070007365744261736550617468002e737766006c6f6164436c697000960400080008013c960400080208033c960400080408053c960400080608073c960b0006000000000000000008081c96020008095217960b00080a080b070100000008021c960200080c52960900080b070100000008021c960200080d52960500070100000047960700070200000008021c960200080e523c960d00080f0600000000000000000810403c960200080f1c96020008118e0c00000100022a00016d63005f009606000401080208021c4f9606000401080a080a1c4f9606000401080008001c4f9606000401080608061c4f9606000401080408041c4f9606000401081208121c4f9606000401081308131c4f960d000600000000000000000401081452174f960d0008150600000000000000000816403c960200080f1c960700070100000008151c96020008175217960b0006000000000000000008183d96090008190702000000081a1c960200081b5217960900081c0501070100000043960400081d081e1c960200081f4e960200082047960200080a1c47960500070100000043960700070200000008081c96020008214e9602000822521796020008191c96020008061c96020008041c47960200082347960700070200000008151c96020008245217070040000000
1 Correct answer

The file size field value is 5f030000, but the byte order is little endian and needs to be inverted. The inverted bytes are 00 00 03 5f (0x35f) (863).
Here's a utility function to invert an unsigned int:
function invertUint(value:uint):uint
{
var result:uint=0;
try{
var ba:ByteArray=new ByteArray();
ba.writeUnsignedInt(value);
ba.position=0;
ba.endian = Endian.LITTLE_ENDIAN;
result = ba.readUnsignedInt();
}
catch(err){}
return result;
}

Copy link to clipboard
Copied
The file size field value is 5f030000, but the byte order is little endian and needs to be inverted. The inverted bytes are 00 00 03 5f (0x35f) (863).
Here's a utility function to invert an unsigned int:
function invertUint(value:uint):uint
{
var result:uint=0;
try{
var ba:ByteArray=new ByteArray();
ba.writeUnsignedInt(value);
ba.position=0;
ba.endian = Endian.LITTLE_ENDIAN;
result = ba.readUnsignedInt();
}
catch(err){}
return result;
}
Copy link to clipboard
Copied
Thank you very much!

Copy link to clipboard
Copied
You're welcome.

