| 1 |
|
| 2 |
package org.freehep.graphicsio.swf; |
| 3 |
|
| 4 |
import java.io.IOException; |
| 5 |
import java.security.MessageDigest; |
| 6 |
import java.security.NoSuchAlgorithmException; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
public class EnableDebugger extends ControlTag { |
| 16 |
|
| 17 |
private String password; |
| 18 |
|
| 19 |
public EnableDebugger(String password) { |
| 20 |
this(); |
| 21 |
|
| 22 |
try { |
| 23 |
MessageDigest md5 = MessageDigest.getInstance("MD5"); |
| 24 |
byte[] b = md5.digest(password.getBytes()); |
| 25 |
this.password = new String(b); |
| 26 |
} catch (NoSuchAlgorithmException nsae) { |
| 27 |
this.password = password; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
public EnableDebugger() { |
| 32 |
super(58, 5); |
| 33 |
} |
| 34 |
|
| 35 |
public SWFTag read(int tagID, SWFInputStream swf, int len) |
| 36 |
throws IOException { |
| 37 |
|
| 38 |
EnableDebugger tag = new EnableDebugger(); |
| 39 |
tag.password = swf.readString(); |
| 40 |
return tag; |
| 41 |
} |
| 42 |
|
| 43 |
public void write(int tagID, SWFOutputStream swf) throws IOException { |
| 44 |
swf.writeString(password); |
| 45 |
} |
| 46 |
} |