|
|||
|
I want to encrypt a binary file, so I read it with Read mathod of ADO.stream, get a number of bytes(say 16 bytes per time), I need to convert it to an Array of Integer, then I can use XOR to encrypt it !(in your manual says that Xor can only worked on Integers)
I can't find methed to do that, do kindly do me a favor! thanks lot ! |
|
|||
|
You may use the getLong and write method to read integers from and write integers to a stringstream. And please be sure to check the length of the stringstream, it may not be exactly times of 4 (length of an integer).
|
|
|||
|
thanks for your answer!
I'm sorry that forgot tell you that the Binary Files are stored in Access MDB, so I had to use ADO.stream instead of stringStream. in fact I've tried stringStream, it seems can't work with Ado.Fields object. code like: ...... var stm = new stringStream() stm.write(rs.Fields(1)) trace(stm.length) // get 0! ...... didn't work,that is: write nothing to stm; |
|
|||
|
Oh! I see!
....... //var stm=new StringStream(); trace(typeof(rs.Fields(0))) // stm = rs.Fields(0).value for (var i=0;i<10;i++){ trace(i+":"+stm.getLong()) } trace(stm.length) // get right len now! var fd = appPath + "_chen.swf" stm.saveToFile(fd); // check'd OK ......... how can I write modified stm Back to Database? ...... rs.Fields(0).value = modifieldStringStream; .... rs.update() .... |
|
|||
|
...............
trace(stm.length) // stm.putPos = stm.length; stm.write("TEST") trace(stm.length) // length increased 4 rs.Fields(0).value = stm rs.update() // database update properly! ............... Everything is OK now ! THANKs alot for your support! Any further suggestions do you have? |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|