Several Popular encryption methods:
The first is to use "SWF encrypt" or doswf Software Encryption. I personally think that SWF encrypt encryption is not very good, not because it is not powerful enough algorithms or something, but the hacker and other cracking software will specifically crack its encryption algorithm. This will cause your soon-encrypted SWF to be broken again. doswf is compiled by Chinese people and is well encrypted, not even visible to movieclip. There is a problem with the SWF of a large file encrypted by dowswf. An error occurs when the SWF is about 1 MB.
The second method is bytearray binary encryption. This method does not make SWF larger, but obfuscation in the original byte stream can play a good anti-cracking role for software such as the hacker genie. The source code on the Internet can be well studied. URL: http://bbs.blueidea.com/thread-2900310-1-97.html. However, this method requires a decrypted SWF (as described below), and the ciphertext in the decryption will still be exposed.
First, let's analyze the encryption principle of bytearray:
The principle of bytearray encryption is to first load the SWF file with urlloader to obtain the data attribute of urlloader (bytearray type), and then break down the bytearray, get an 8-bit byte stream. Then, shift the byte stream (that is, the encrypted number, which is + 13 in this article), and finally obtain a new byte stream array for storage.
The same is true for decryption: import the file first, get bytearray, and break it into eight-bit byte streams. (The decryption method is to reverse shift the byte stream, that is, encryption is + 13, decryption is-13). In this way, a new byte stream array is generated as a SWF file that can be used.
In this way, encryption exposes the problem that only digital encryption can be used. Later, I found another big problem: the core principle of encryption is the encryption of byte streams (8 bits, because it is 8 bits, the range can only be: 0 ~ Between 255, then you will get the remainder of 255 If you use more than 255 of the digital encryption. Do not believe you use the 256 digital encryption to see what you get? It turned out to be the encrypted SWF, which is consistent with the original SWF. The reason is that 256 is changed to 0, and your displacement is + 0. Of course it is not changed. Because there can be only 256 types of encrypted files generated by this encryption method, so I need to solve the problem from 0 ~ You can obtain the decrypted SWF by one of the 255.
Therefore, we can improve the encryption algorithm by using strings as ciphertext. Convert the string into an ASCII array (for example, "ABC", the corresponding ASCII array is, 98, 99), and then cyclically encrypt it with the byte stream array of the file. For example, if a 1 k swf is used, it has 1024 byte streams, the first byte stream is displaced by 97, the second and 98 are displaced, and the third and 99 are shifted, the fourth round repeats with 97 plus. In this way, there will be an infinite number of encrypted files. Only the ciphertext can be obtained for decryption.
The encryption and decryption methods are as follows:
// Encryption function
Private function compress (byte: bytearray): bytearray {
Var key: String = password. Text; // obtain the ciphertext.
VaR flag: Int = 0;
VaR newbyte: bytearray = new bytearray ();
/**/
For (var I: Int = 0; I <byte. length; I ++, flag ++ ){
If (flag> = key. Length ){
Flag = 0;
}
Newbyte. writebyte (byte [I] + key. charcodeat (FLAG ));
// Newbyte. writebyte (byte [I] + 256 );
}
// Output
Filebytearray = newbyte;
Savebtn. Visible = true;
Return newbyte;
}
// Decryption Function
Private function uncompress (byte: bytearray): bytearray {
Var key: String = password. Text; // obtain the ciphertext.
VaR flag: Int = 0;
VaR newbyte: bytearray = new bytearray ();
/**/
For (var I: Int = 0; I <byte. length; I ++, flag ++ ){
If (flag> = key. Length ){
Flag = 0;
}
Newbyte. writebyte (byte [I]-key. charcodeat (FLAG ));
// Newbyte. writebyte (byte [I] + 256 );
}
// Trace (newbyte );
Filebytearray = newbyte;
Savebtn. Visible = true;
Return newbyte;
}
If you are using your own player, you can use more encryption methods, suchUseAESAddPassword.
BenefitUseAESAddPasswordFangTypePairSWFGridTypeTextPartsIntoLineIntegerBodyAddPassword,SlaveWhileDefenseStopWhenTodayStreamLineOfReverseEditingTranslationSoftPartsOfAttackClick.SameHourYesInAddPasswordHourRefersSetTextPartsOfEnableUsePeriodLimited(That isPassPeriodHourRoom).InBroadcastReleaseTextPartsOfBeforeBroadcastReleaseToolYesSubmitDisplayPasswordCodeInputInboundToAndPassPeriodSubmitAwake.InOffClosedBroadcastReleaseToolHourYesClearDivisionHardDiskUpperOfProHourQuantityDataToDefenseStopLeakLeakage.