2 bytes of message length Iso 8583 - message

I got the following beginning of a Iso message (in Hex)
20 80 00 00 50 F0 F8 F1 F0 F8 F2 F3 F8 F0 F0.....
And I know that this iso has 2 bytes (20 80) to calculate the message length. The result I got is 160 (Dec), but the real message length is 734. Anyone knows how to get this result?

I solved the problem, the 20 in the beginning means that the message has more than one block. eg.
the beginnig and the final part of the message is
20 80 00 00 50 F0 F8 F1 F0 F8 F2 F3 F8 F0 F0 F0 F0 F0 F2 F4 F1 F0 F0 F0 F0 F0 F4 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F2 F1 F1 F0 F3 F1 F8 F2 F6 F5 F0 F0 F2 F7 F3 F0 F0 F1 F8 F2 F6 F5 F0 F1 F1 F0 F3 F0 F0 F0 F5 F2 F8 F8 F9 F0 F3 F5 F2 F8 F7 F6 F7 F5 F6 F2 F4 C9 D5 C1 F0 F0 F1 F0 F3 F0 F7 F2 F0 F1 F4 F0 F1 F0 F1 F6 F0 F3 F0 F0 F0 F0 F1 F4 F0 F7 F0 F3 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 20 80 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F1 F1 F1 F1 F1 F0 F1 F1 F1 F1 F1 F1 F0 F1 F1 F0 F1 F1 F1 F1 F0 F0 F0 F0 F1 F0 F0 F1 F1 F1 F1 F1 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 F0 F0 F0 F0 F0 F0 F0 F0 20 80 F0 F0 F0 F0 F0 F0 F0 F0 F2 F9 F9 F9 F9 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F9 F8 F6 F0 F0 F7 F6 F0 F2 F9 F9 F0 F2 F1 F2 F0 F2 F1 F2 F0 F2 F1 F2 F0 F3 F0 F3 F0 F2 F9 F9 F0 F2 F9 F9 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F0 F0 F0 F0 F0 F0 F0 F0 F1 F0 F0 F0 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F0 F0 F0 F0 F0 F0 F0 F0 F1 F0 F0 F0 F9 F9 F9 F9 F9 F9 F9 ....... 00 54 F0 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F0 F2 F3 F0 F0 F0 F0 F0 F0 F0 F4 F0 F4 F0 F4 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F0 F0 F1 F0 F0 F9 F7 F5 F3 F2 F1 F1 F9 F4 F2
so I needed to break the message in blocks of 128 bytes.
20 means that the message has another block
80 means that this block has 128 bytes
Then I got the first block
20 80 00 00 50 F0 F8 F1 F0 F8 F2 F3 F8 F0 F0 F0 F0 F0 F2 F4 F1 F0 F0 F0 F0 F0 F4 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F2 F1 F1 F0 F3 F1 F8 F2 F6 F5 F0 F0 F2 F7 F3 F0 F0 F1 F8 F2 F6 F5 F0 F1 F1 F0 F3 F0 F0 F0 F5 F2 F8 F8 F9 F0 F3 F5 F2 F8 F7 F6 F7 F5 F6 F2 F4 C9 D5 C1 F0 F0 F1 F0 F3 F0 F7 F2 F0 F1 F4 F0 F1 F0 F1 F6 F0 F3 F0 F0 F0 F0 F1 F4 F0 F7 F0 F3 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0
the second block is the same
20 means that the message has another block
80 means that this block has 128 bytes
Then I got the second block
20 80 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F1 F1 F1 F1 F1 F0 F1 F1 F1 F1 F1 F1 F0 F1 F1 F0 F1 F1 F1 F1 F0 F0 F0 F0 F1 F0 F0 F1 F1 F1 F1 F1 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 F0 F0 F0 F0 F0 F0 F0 F0
until the last block
00 means that the message has no more blocks
54 means that this final block has 84 bytes
then the final block is
00 54 F0 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F0 F2 F3 F0 F0 F0 F0 F0 F0 F0 F4 F0 F4 F0 F4 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F0 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F9 F0 F0 F1 F0 F0 F9 F7 F5 F3 F2 F1 F1 F9 F4 F2

Related

Transferring photos from a Nikon Z50 with Airnef/PTPIP program is slowing down until disconnection

I am using Airnef (and the PTPIP protocol) to download pictures from my Nikon Z50 camera through Wi-Fi.
It works perfectly in some cases, but in other cases the transfer is slowing down until the camera has been disconnected.
I have read the associated documentation (available here https://www.testcams.com/airnef/) and seen that a similar issue has been encountered while the program has been developed, which seemed to be caused by a bug in the Nikon firmware which lead to some memory issues and a possible disconnection. The same issue seems to have been found during gphoto2 development (https://sourceforge.net/p/gphoto/mailman/gphoto-devel/thread/20190107075304.GC4614%40jet.franken.de/)
From what I understand, the parameters "maxgetobjbuffersizekb" and "maxgetobjtransferzekb" have been introduced to fix a such issue by trying to limit the requested sizes on the camera to transfer image, however it does not seems to work in my case.
I have tried to customize the values used by these parameters (for instance, by using a value of 256kb for maxgetobjtransferzekb setting), but with no real luck (the connection seems to abort less often but the transfer is still slowing down).
Here is an extract of the trace I get when I increase the log level in airnef.
Download history file "C:\Users\aerkis\AppData\Local\airnef\appdata\Z 50-SN6026496-downloadhist" loaded - 2 entries
Skipping DCIM - object is not file - MTP_OBJFORMAT_Assocation (0x3001)
Skipping 101NZ_50 - object is not file - MTP_OBJFORMAT_Assocation (0x3001)
>> MTP_OP_GetObject
Downloading "DSC_0490.JPG": 0%DSC_0490.JPG - downloading next piece, offset=0x0, count=0x100000
execMtpOp: MTP_OP_GetPartialObject - CmdReq payload:
0000: 06 00 00 00 01 00 00 00 - 1b 10 0b 00 00 00 ea 41 ........ - .......A
0010: 19 29 00 00 00 00 00 00 - 10 00 .)...... - ..
execMtpOp: MTP_OP_GetPartialObject - DataStart payload [expected data bytes is 0x100000]
0000: 09 00 00 00 0b 00 00 00 - 00 00 10 00 00 00 00 00 ........ - ........
0%execMtpOp: MTP_OP_GetPartialObject - Data payload [ID a] (0x00005b3c bytes):
0000: 0a 00 00 00 0b 00 00 00 - ff d8 ff e1 ff fe 45 78 ........ - ......Ex
0010: 69 66 00 00 49 49 2a 00 - 08 00 00 00 0d 00 0f 01 if..II*. - ........
0020: 02 00 12 00 00 00 ac 00 - 00 00 10 01 02 00 0b 00 ........ - ........
0030: 00 00 c0 00 00 00 12 01 - 03 00 01 00 00 00 01 00 ........ - ........
1%execMtpOp: MTP_OP_GetPartialObject - Data payload [ID a] (0x00005b3c bytes):
0000: 0a 00 00 00 0b 00 00 00 - 4f 00 72 a5 99 4e c4 fb ........ - O.r..N..
0010: f3 a3 26 61 66 1d 98 d7 - d7 98 1a 5d cc 26 ac f3 ..&af... - ...].&..
0020: f3 c4 4e 99 a5 72 00 4f - 5e 30 c2 15 12 f9 94 eb ..N..r.O - ^0......
0030: 03 dc 76 d1 ed ca 68 c7 - e7 c8 6a cd f1 d6 7c e3 ..v...h. - ..j...|.
execMtpOp: MTP_OP_GetPartialObject - Data payload [ID a] (0x00005b3c bytes):
0000: 0a 00 00 00 0b 00 00 00 - 00 00 00 00 00 00 00 00 ........ - ........
0010: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ........ - ........
0020: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ........ - ........
0030: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ........ - ........
2%execMtpOp: MTP_OP_GetPartialObject - Partial payload after error (0x00004329 bytes):
0000: 0a 00 00 00 0b 00 00 00 - 20 20 20 20 20 20 20 20 ........ -
0010: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0020: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0030: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0040: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0050: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0060: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0070: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0080: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
0090: 20 20 20 20 20 20 20 20 - 20 20 20 20 20 20 20 20 -
DSC_0490.JPG - error during download, writing 0x0 bytes of buffered data
DSC_0490.JPG - writing partial payload data of 0x154bd bytes
C:\Users\aerkis\Pictures\DSC_0490.JPG writing 0x154bd bytes, closeAfterWriting=0
MTP_OP_GetPartialObject: Socket error, partial data received - 0x4321 of 0x5b34 bytes for specific payload, 0x154bd of 0x100000 of total data bytes expected. Error: timed out
Therefore, I request some help to know if it exists a way to better understand this problem and possibly correct it (maybe by configuring some parameters ?).
Any help would be greatly appreciated !

Indy odd/strang behavior with TLS version

I sometimes get TLSv1 even when I set the version explicit to TLSv1.2.
I get this exception:
First chance exception at $75D917D2. Exception class
EIdOSSLConnectError with message 'Error connecting with SSL. EOF was
observed that violates the protocol'.
My Delphi version:
Embarcadero® RAD Studio 10 Seattle Version 23.0.21418.4207
I am on Windows 10:
Microsoft Windows [Version 10.0.17134.345]
My Indy Version: 10.6.2.5311 - That's what's coming with Seattle
This is a trace when it works:
This is a trace when it does NOT work:
As you can see it is TLSv1. Why?
I had a look at following questions:
Using Indy 10 IdHTTP with TLS 1.2
EIdOSSLConnectError Error connecting with SSL - EOF was observed
Here is my example code:
procedure TOpenWeatherFr.SetIcon(const IconCode: String);
var
HTTPS: TSSLHTTP;
MS : TMemoryStream;
PNG: TPngImage;
URL: string;
begin
HTTPS := TSSLHTTP.Create(nil);
MS := TMemoryStream.Create;
PNG := TPngImage.Create;
URL := 'https://openweathermap.org/img/w/' + IconCode + '.png';
try
(HTTPS.IOHandler as TIdSSLIOHandlerSocketOpenSSL).SSLOptions.SSLVersions := [sslvTLSv1_2];
HTTPS.Get(URL, MS);
MS.Seek(0, soFromBeginning);
PNG.LoadFromStream(MS);
Image1.Picture.Assign(PNG);
finally
HTTPS.Free;
PNG.Free;
MS.Free;
end;
Image1.Visible := true;
end;
For the sake of completeness here is the code of TSSLHTTP. The purpose is an old Indy version without SNI Support.
unit SSLHTTP;
interface
uses
Classes, IdHTTP, IdSSLOpenSSLHeaders, IdCTypes;
type
TSSLHTTP = class(TIdHTTP)
private
procedure OnStatusInfoEx(ASender: TObject; const AsslSocket: PSSL; const AWhere, Aret: TIdC_INT; const AType, AMsg: String);
public
constructor Create(AOwner: TComponent);
end;
implementation
uses
IdSSLOpenSSL;
{ TSSLHTTP }
constructor TSSLHTTP.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(self);
(IOHandler as TIdSSLIOHandlerSocketOpenSSL).OnStatusInfoEx := OnStatusInfoEx;
end;
procedure TSSLHTTP.OnStatusInfoEx(ASender: TObject; const AsslSocket: PSSL;
const AWhere, Aret: TIdC_INT; const AType, AMsg: String);
begin
SSL_set_tlsext_host_name(AsslSocket, Request.Host);
end;
end.
Where is my mistake? What am I doing wrong? This is the URL of the image I download:
https://openweathermap.org/img/w/04d.png
EDIT: Adding paylod as hex dumb
Working payload - Client Hello:
0000 16 03 01 01 49 01 00 01 45 03 03 8b 3d e5 54 59
0010 f8 59 44 82 f7 14 92 45 50 e1 a3 86 68 3a c2 94
0020 76 be ea 8b 54 98 f3 27 69 50 af 00 00 94 c0 30
0030 c0 2c c0 28 c0 24 c0 14 c0 0a 00 a3 00 9f 00 6b
0040 00 6a 00 39 00 38 c0 32 c0 2e c0 2a c0 26 c0 0f
0050 c0 05 00 9d 00 3d 00 35 00 88 00 87 00 84 c0 2f
0060 c0 2b c0 27 c0 23 c0 13 c0 09 00 a2 00 9e 00 67
0070 00 40 00 33 00 32 c0 31 c0 2d c0 29 c0 25 c0 0e
0080 c0 04 00 9c 00 3c 00 2f 00 9a 00 99 00 45 00 44
0090 00 96 00 41 00 07 c0 11 c0 07 c0 0c c0 02 00 05
00a0 00 04 c0 12 c0 08 00 16 00 13 c0 0d c0 03 00 0a
00b0 00 15 00 12 00 09 00 14 00 11 00 08 00 06 00 03
00c0 00 ff 01 00 00 88 00 00 00 17 00 15 00 00 12 6f
00d0 70 65 6e 77 65 61 74 68 65 72 6d 61 70 2e 6f 72
00e0 67 00 0b 00 04 03 00 01 02 00 0a 00 34 00 32 00
00f0 0e 00 0d 00 19 00 0b 00 0c 00 18 00 09 00 0a 00
0100 16 00 17 00 08 00 06 00 07 00 14 00 15 00 04 00
0110 05 00 12 00 13 00 01 00 02 00 03 00 0f 00 10 00
0120 11 00 23 00 00 00 0d 00 20 00 1e 06 01 06 02 06
0130 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 03
0140 02 03 03 02 01 02 02 02 03 00 0f 00 01 01
Not working payload - Client hello:
0000 16 03 01 01 49 01 00 01 45 03 03 f6 7b de 81 5d
0010 76 74 a7 31 99 36 8d 17 4c 07 5e 73 5d f7 b8 a1
0020 4f 06 5e 91 e5 f0 4b 37 0d 65 e7 00 00 94 c0 30
0030 c0 2c c0 28 c0 24 c0 14 c0 0a 00 a3 00 9f 00 6b
0040 00 6a 00 39 00 38 c0 32 c0 2e c0 2a c0 26 c0 0f
0050 c0 05 00 9d 00 3d 00 35 00 88 00 87 00 84 c0 2f
0060 c0 2b c0 27 c0 23 c0 13 c0 09 00 a2 00 9e 00 67
0070 00 40 00 33 00 32 c0 31 c0 2d c0 29 c0 25 c0 0e
0080 c0 04 00 9c 00 3c 00 2f 00 9a 00 99 00 45 00 44
0090 00 96 00 41 00 07 c0 11 c0 07 c0 0c c0 02 00 05
00a0 00 04 c0 12 c0 08 00 16 00 13 c0 0d c0 03 00 0a
00b0 00 15 00 12 00 09 00 14 00 11 00 08 00 06 00 03
00c0 00 ff 01 00 00 88 00 00 00 17 00 15 00 00 12 6f
00d0 70 65 6e 77 65 61 74 68 65 72 6d 61 70 2e 6f 72
00e0 67 00 0b 00 04 03 00 01 02 00 0a 00 34 00 32 00
00f0 0e 00 0d 00 19 00 0b 00 0c 00 18 00 09 00 0a 00
0100 16 00 17 00 08 00 06 00 07 00 14 00 15 00 04 00
0110 05 00 12 00 13 00 01 00 02 00 03 00 0f 00 10 00
0120 11 00 23 00 00 00 0d 00 20 00 1e 06 01 06 02 06
0130 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 03
0140 02 03 03 02 01 02 02 02 03 00 0f 00 01 01

What is the character encoding of this file?

file extension is .PRO
is decoded correctly by Notepad(!)
is decoded correctly by Python via dbcs codec, but only on Windows
most other programs (file, chardet, sublime-text, ...) incorrectly classify it as UTF-8 (and accordingly display Chinese characters)
it seems like every three bytes encode two characters
You would think (3) would settle it ("it's an East Asian multi-byte encoding"), but then why don't chardet et al. detect it?
Here is the hexdump -C of it along with the ANSI output of Notepad.
00000000 e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 |................|
00000010 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 |................|
00000020 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad |................|
00000030 e2 b4 ad e2 b4 ad e2 b4 ad e0 b4 ad e2 80 8a e2 |................|
00000040 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e4 b4 a0 e4 b1 |................|
00000050 85 e4 9d 81 e5 98 a0 e6 8d a1 e6 ad b5 e6 85 ac |................|
00000060 e2 81 b6 e3 84 b3 e4 88 ad e0 a8 8d e2 b4 ad e2 |................|
00000070 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 |................|
00000080 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad |................|
00000090 e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 |................|
000000a0 b4 ad e2 b4 ad e0 b4 ad e0 b4 8a e5 80 8a e6 bd |................|
000000b0 b2 e7 89 a7 e6 b5 a1 e2 81 ad e2 80 a0 e3 a8 a0 |................|
000000c0 e5 94 a0 e6 a5 ae e6 95 b6 e7 8d b2 e6 b1 a1 e5 |................|
000000d0 80 ad e6 bd b2 e7 89 a7 e6 b5 a1 e0 b5 ad e2 80 |................|
000000e0 8a e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 |................|
000000f0 e2 80 a0 e3 84 a0 e3 90 b3 e4 8e b0 e7 98 a0 e7 |................|
00000100 89 a5 e6 85 b0 e6 ad a3 e0 b5 b4 e4 90 8a e7 91 |................|
00000110 a1 e6 b5 b5 e2 80 a0 e2 80 a0 e2 80 a0 e3 a8 a0 |................|
00000120 e3 84 a0 e2 b8 b5 e3 8c b0 e3 88 ae e3 84 b0 e0 |................|
00000130 b4 b3 e5 94 8a e7 89 a8 e6 95 ba e7 91 a9 e2 80 |................|
00000140 a0 e2 80 a0 e3 a8 a0 e3 84 a0 e3 a8 b7 e3 94 b4 |................|
00000150 e3 8c ba e2 80 b0 e2 80 a0 e2 a0 a0 e7 91 93 e7 |................|
00000160 89 a1 e2 a5 b4 e0 a8 8d e6 a1 83 e7 89 a1 e6 95 |................|
00000170 a7 e4 b8 a0 e2 b9 b2 e2 80 a0 e2 80 ba e3 8c a0 |................|
00000180 e0 a8 8d e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 |................|
00000190 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 |................|
000001a0 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad |................|
000001b0 e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e0 b4 ad e0 |................|
000001c0 b4 8a e5 98 8a e7 89 af e6 95 a8 e7 a9 a9 e6 b9 |................|
000001d0 b5 e2 81 a7 e2 80 a0 e2 80 a0 e2 80 a0 e3 88 b1 |................|
000001e0 e2 b8 b0 e2 80 b8 e4 8e b0 e0 a8 8d e4 a5 81 e3 |................|
000001f0 99 8e e2 80 ba e6 95 8c e7 91 a9 e6 95 b7 e7 91 |................|
00000200 b2 e2 80 a0 e2 80 a0 e2 80 a0 e3 88 a0 eb 94 a0 |................|
00000210 e2 bd 93 e6 b5 a3 e0 a8 8d e0 a8 8d e7 89 90 e6 |................|
00000220 9d af e6 85 b2 e6 b5 ad e6 8d b3 e7 89 a8 e7 91 |................|
00000230 a9 e2 81 b4 e2 80 a0 e7 89 84 e6 8d b5 e2 81 ab |................|
00000240 e5 90 a0 e6 b5 a5 e6 95 b0 e6 85 b2 e2 b9 b4 e5 |................|
00000250 a8 a0 e6 a5 a5 e2 81 b4 e0 a8 8d e2 80 a0 e2 80 |................|
00000260 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 |................|
00000270 e2 80 a0 e2 80 a0 e6 88 a0 e7 89 a1 e2 80 a0 e2 |................|
00000280 80 a0 e2 80 a0 e4 8e b0 e2 80 a0 e2 80 a0 e6 b4 |................|
00000290 a0 e6 b9 a9 e0 b4 a0 e0 b4 8a e5 8c 8a e6 85 b4 |................|
000002a0 e7 91 b2 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 |................|
000002b0 80 a0 e2 80 a0 e2 80 a0 e2 b8 b0 e3 98 b0 e2 80 |................|
000002c0 a0 e2 80 a0 e3 98 a0 e2 b8 b8 e2 80 b1 e3 80 a0 |................|
000002d0 e3 a8 b0 e3 80 b0 e0 a8 8d e2 b8 b1 e7 89 86 e6 |................|
000002e0 ad a1 e6 a5 b4 e6 b9 af e6 95 a9 e7 95 b2 e6 9d |................|
000002f0 ae e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 |................|
00000300 e2 80 a0 e2 80 a0 e2 80 a0 e0 a8 8d e2 80 a0 e7 |................|
00000310 99 85 e6 ad a1 e6 a5 b5 e7 89 a5 e6 b9 b5 e2 81 |................|
00000320 a7 e2 80 a0 e2 80 a0 e3 80 ad e3 a4 ae e2 80 b2 |................|
00000330 e2 80 a0 e2 80 a0 e3 98 b6 e3 90 ae e2 80 a0 e3 |................|
00000340 88 b0 e3 88 ba e0 b4 b9 e2 80 8a e4 90 a0 e6 b5 |................|
00000350 a1 e6 99 b0 e6 a5 a5 e6 b1 ae e7 8d a1 e2 81 b3 |................|
00000360 e2 80 a0 e2 80 a0 e2 b8 b0 e3 80 b4 e2 80 a0 e2 |................|
00000370 80 a0 e3 80 b1 e2 b8 b8 e2 80 b3 e3 80 a0 e3 a8 |................|
00000380 b4 e3 80 b5 e0 a8 8d e2 b8 b2 e7 89 86 e6 ad a1 |................|
00000390 e6 a5 b4 e6 b9 af e6 95 a9 e7 95 b2 e6 9d ae e2 |................|
000003a0 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 |................|
000003b0 a0 e2 80 a0 e2 80 a0 e0 a8 8d e2 80 a0 e7 99 85 |................|
000003c0 e6 ad a1 e6 a5 b5 e7 89 a5 e6 b9 b5 e2 81 a7 e2 |................|
000003d0 80 a0 e2 80 a0 e3 80 ad e3 a0 ae e2 80 b2 e2 80 |................|
000003e0 a0 e2 80 a0 e3 a0 b6 e3 94 ae e2 80 a0 e3 9c b0 |................|
000003f0 e3 80 ba e0 b4 b3 e2 80 8a e4 90 a0 e6 b5 a1 e6 |................|
00000400 99 b0 e6 a5 a5 e6 b1 ae e7 8d a1 e2 81 b3 e2 80 |................|
00000410 a0 e2 80 a0 e2 b8 b0 e3 84 b4 e2 80 a0 e2 80 a0 |................|
00000420 e3 80 b1 e2 b8 b9 e2 80 b6 e3 80 a0 e3 a8 b8 e3 |................|
00000430 90 b5 e0 a8 8d e2 b8 b3 e7 89 86 e6 ad a1 e6 a5 |................|
00000440 b4 e6 b9 af e6 95 a9 e7 95 b2 e6 9d ae e2 80 a0 |................|
00000450 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 |................|
00000460 80 a0 e2 80 a0 e0 a8 8d e2 80 a0 e7 99 85 e6 ad |................|
00000470 a1 e6 a5 b5 e7 89 a5 e6 b9 b5 e2 81 a7 e2 80 a0 |................|
00000480 e2 80 a0 e3 80 ad e3 a0 ae e2 80 b2 e2 80 a0 e2 |................|
00000490 80 a0 e3 80 b7 e3 a4 ae e2 80 a0 e3 84 b1 e3 94 |................|
000004a0 ba e0 b4 b0 e2 80 8a e4 90 a0 e6 b5 a1 e6 99 b0 |................|
000004b0 e6 a5 a5 e6 b1 ae e7 8d a1 e2 81 b3 e2 80 a0 e2 |................|
000004c0 80 a0 e2 b8 b0 e3 80 b4 e2 80 a0 e2 80 a0 e3 80 |................|
000004d0 b1 e2 b8 b9 e2 80 b5 e3 84 a0 e3 a8 b3 e3 80 b4 |................|
000004e0 e0 a8 8d e7 89 84 e6 8d b5 e6 85 ab e6 99 b5 e6 |................|
000004f0 85 a2 e2 81 b5 e2 80 a0 e2 80 a0 e2 80 a0 e3 88 |................|
00000500 a0 e3 80 ae e2 80 b5 e2 80 a0 e3 84 a0 e3 90 b3 |................|
00000510 e3 84 ae e2 80 a0 e3 98 b1 e3 80 ba e0 b4 b6 e5 |................|
00000520 8c 8a e6 95 b4 e6 a5 b2 e2 b9 ac e4 88 a0 e6 9d |................|
00000530 a5 e6 b9 a9 e2 81 ae e2 80 a0 e2 80 a0 e2 b8 b2 |................|
00000540 e3 94 b0 e2 80 a0 e2 80 a0 e3 8c b1 e2 b8 b4 e2 |................|
00000550 80 b1 e3 84 a0 e3 a8 b6 e3 98 b0 e0 a8 8d e7 91 |................|
00000560 93 e7 89 a5 e6 b1 a9 e2 80 ae e6 b9 85 e6 95 a4 |................|
00000570 e2 80 a0 e2 80 a0 e2 80 a0 e3 88 a0 e3 88 ae e2 |................|
00000580 80 b0 e2 80 a0 e3 84 a0 e3 98 b3 e3 80 ae e2 80 |................|
00000590 a0 e3 84 b2 e3 8c ba e0 b4 b6 e4 90 8a e7 95 b2 |................|
000005a0 e6 ad a3 e6 89 a1 e6 85 ac e7 8d b3 e2 80 a0 e2 |................|
000005b0 80 a0 e2 80 a0 e2 80 a0 e2 b8 b0 e3 80 b2 e2 80 |................|
000005c0 a0 e2 80 a0 e3 80 b1 e2 b8 b5 e2 80 b2 e3 88 a0 |................|
000005d0 e3 a8 b2 e3 94 b3 e0 a8 8d e6 85 96 e7 95 ab e6 |................|
000005e0 b5 b5 e5 90 ad e6 bd b2 e6 ad a3 e6 95 ae e2 81 |................|
000005f0 ae e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 |................|
00000600 e2 80 a0 e2 80 a0 e0 a8 8d e2 80 a0 e7 89 94 e6 |................|
00000610 8d af e6 b9 ab e6 b9 a5 e4 88 a0 e6 9d a5 e6 b9 |................|
00000620 a9 e2 81 ae e3 80 ad e3 8c ae e2 80 b0 e2 80 a0 |................|
00000630 e2 80 a0 e3 88 b9 e3 84 ae e2 80 a0 e3 88 b2 e3 |................|
00000640 90 ba e0 b4 b9 e2 80 8a e5 90 a0 e6 bd b2 e6 ad |................|
00000650 a3 e7 95 ae e6 9d ae e6 91 b3 e7 95 b2 e6 ad a3 |................|
00000660 e2 b4 a0 e2 b8 b0 e3 90 b8 e2 80 a0 e2 80 a0 e3 |................|
00000670 a0 a0 e2 b8 b1 e2 80 b5 e3 88 a0 e3 a8 b4 e3 9c |................|
00000680 b4 e0 a8 8d e2 80 a0 e7 89 94 e6 8d af e6 b9 ab |................|
00000690 e6 b9 b5 e7 8d a7 e7 89 a4 e6 8d b5 e2 81 ab e3 |................|
000006a0 80 ad e3 a0 ae e2 80 b7 e2 80 a0 e2 80 a0 e3 8c |................|
000006b0 b8 e3 90 ae e2 80 a0 e3 98 b2 e3 90 ba e0 b4 b7 |................|
000006c0 e2 80 8a e5 90 a0 e6 bd b2 e6 ad a3 e7 95 ae e6 |................|
000006d0 9d ae e6 91 b3 e7 95 b2 e6 ad a3 e2 b4 a0 e2 b8 |................|
000006e0 b0 e3 a4 b8 e2 80 a0 e2 80 a0 e3 a0 a0 e2 b8 b0 |................|
000006f0 e2 80 b2 e3 88 a0 e3 a8 b8 e3 9c b4 e0 a8 8d e2 |................|
00000700 80 a0 e7 89 94 e6 8d af e6 b9 ab e6 b9 b5 e7 8d |................|
00000710 a7 e7 89 a4 e6 8d b5 e2 81 ab e3 80 ad e3 a4 ae |................|
00000720 e2 80 b0 e2 80 a0 e2 80 a0 e3 9c b7 e3 98 ae e2 |................|
00000730 80 a0 e3 80 b3 e3 90 ba e0 b4 b7 e2 80 8a e5 90 |................|
00000740 a0 e6 bd b2 e6 ad a3 e7 95 ae e6 9d ae e6 91 b3 |................|
00000750 e7 95 b2 e6 ad a3 e2 b4 a0 e2 b8 b0 e3 80 b9 e2 |................|
00000760 80 a0 e2 80 a0 e3 9c a0 e2 b8 b6 e2 80 b1 e3 8c |................|
00000770 a0 e3 a8 b2 e3 9c b4 e0 a8 8d e2 80 a0 e7 89 94 |................|
00000780 e6 8d af e6 b9 ab e6 b9 b5 e7 8d a7 e7 89 a4 e6 |................|
00000790 8d b5 e2 81 ab e3 80 ad e3 a4 ae e2 80 b1 e2 80 |................|
000007a0 a0 e2 80 a0 e3 94 b7 e3 84 ae e2 80 a0 e3 90 b3 |................|
000007b0 e3 90 ba e0 b4 b7 e2 80 8a e5 90 a0 e6 bd b2 e6 |................|
000007c0 ad a3 e7 95 ae e6 9d ae e6 91 b3 e7 95 b2 e6 ad |................|
000007d0 a3 e2 b4 a0 e2 b8 b0 e3 84 b9 e2 80 a0 e2 80 a0 |................|
000007e0 e3 9c a0 e2 b8 b4 e2 80 b4 e3 8c a0 e3 a8 b6 e3 |................|
000007f0 9c b4 e0 a8 8d e2 80 a0 e7 89 94 e6 8d af e6 b9 |................|
00000800 ab e6 b9 b5 e7 8d a7 e7 89 a4 e6 8d b5 e2 81 ab |................|
00000810 e3 80 ad e3 a4 ae e2 80 b1 e2 80 a0 e2 80 a0 e3 |................|
00000820 90 b7 e3 84 ae e2 80 a0 e3 a0 b3 e3 90 ba e0 b4 |................|
00000830 b7 e2 80 8a e5 90 a0 e6 bd b2 e6 ad a3 e7 95 ae |................|
00000840 e6 9d ae e6 91 b3 e7 95 b2 e6 ad a3 e2 b4 a0 e2 |................|
00000850 b8 b0 e3 84 b9 e2 80 a0 e2 80 a0 e3 9c a0 e2 b8 |................|
00000860 b3 e2 80 b8 e3 90 a0 e3 a8 b0 e3 9c b4 e0 a8 8d |................|
00000870 e2 80 a0 e7 89 94 e6 8d af e6 b9 ab e6 b9 b5 e7 |................|
00000880 8d a7 e7 89 a4 e6 8d b5 e2 81 ab e3 80 ad e3 a4 |................|
00000890 ae e2 80 b1 e2 80 a0 e2 80 a0 e3 8c b7 e3 98 ae |................|
000008a0 e2 80 a0 e3 88 b4 e3 90 ba e0 b4 b7 e2 80 8a e5 |................|
000008b0 90 a0 e6 bd b2 e6 ad a3 e6 95 ae e2 81 ae e6 b9 |................|
000008c0 85 e6 95 a4 e2 80 a0 e2 b4 a0 e2 b8 b0 e3 9c b8 |................|
000008d0 e2 80 a0 e2 80 a0 e3 9c a0 e2 b8 b3 e2 80 b8 e3 |................|
000008e0 90 a0 e3 a8 b2 e3 a4 b4 e0 a8 8d e6 95 82 ef b1 |................|
000008f0 ac e7 91 a6 e6 b9 a5 e2 80 a0 e2 80 a0 e2 80 a0 |................|
00000900 e2 80 a0 e2 80 a0 e3 80 ad e3 88 ae e2 80 b7 e2 |................|
00000910 80 a0 e2 80 a0 e3 94 b7 e3 a4 ae e2 80 a0 e3 8c |................|
00000920 b4 e3 80 ba e0 b4 b0 e4 94 8a e6 91 ae e2 81 a5 |................|
00000930 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 a0 e2 |................|
00000940 80 a0 e2 80 a0 e2 b8 b0 e3 80 b0 e2 80 a0 e2 80 |................|
00000950 a0 e3 9c a0 e2 b8 b6 e2 80 b9 e3 90 a0 e3 a8 b3 |................|
00000960 e3 88 b1 e0 a8 8d e0 a8 8d e2 b4 ad e2 b4 ad e2 |................|
00000970 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 |................|
00000980 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad |................|
00000990 e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 |................|
000009a0 b4 ad e0 b4 ad e0 b4 8a e2 80 8a e2 80 a0 e5 89 |................|
000009b0 90 e4 9d 8f e4 85 92 e4 b5 8d e4 94 a0 e4 99 92 |................|
000009c0 e4 b1 8f e5 89 87 e4 a5 85 e4 a1 83 e4 84 a0 e4 |................|
000009d0 9d 82 e4 b1 85 e5 95 81 e4 95 86 e2 85 8e e0 a8 |................|
000009e0 8d e0 a8 8d e6 95 94 e7 81 ad e7 89 a5 e7 91 a1 |................|
000009f0 e7 89 b5 e2 80 a0 e2 80 a0 e2 80 a0 e2 80 ba e3 |................|
00000a00 8c b1 e2 b8 b5 e2 80 b9 e2 ac a0 e2 b8 b0 e2 80 |................|
00000a10 b4 e2 b4 af e2 b8 b0 e2 80 b4 e4 8e b0 e0 a8 8d |................|
00000a20 e7 89 84 e6 8d b5 e2 81 ab e2 80 a0 e2 80 a0 e2 |................|
00000a30 80 a0 e2 80 a0 e2 80 a0 e2 80 ba e2 80 a0 e2 b8 |................|
00000a40 b2 e3 a0 b1 e2 ac a0 e2 b8 b0 e3 90 b0 e2 b4 af |................|
00000a50 e2 b8 b0 e3 90 b0 e6 88 a0 e7 89 a1 e0 a8 8d e7 |................|
00000a60 91 93 e7 89 a5 e6 b1 a9 e7 8d a9 e6 95 a9 e7 a9 |................|
00000a70 b2 e6 a5 a5 e2 81 b4 e2 80 ba e3 94 a0 e6 b4 a0 |................|
00000a80 e6 b9 a9 e3 8c a0 e2 80 b0 e0 b5 b3 e5 94 8a e7 |................|
00000a90 89 a8 e6 95 ba e7 91 a9 e2 80 a0 e2 80 a0 e2 80 |................|
00000aa0 a0 e2 80 a0 e3 a8 a0 e3 84 a0 e3 a8 b8 e3 a0 b2 |................|
00000ab0 e3 90 ba e2 80 b2 e4 94 a8 e6 91 ae e2 a5 a5 e0 |................|
00000ac0 a8 8d e0 a8 8d e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 |................|
00000ad0 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad |................|
00000ae0 e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 |................|
00000af0 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e2 b4 ad e0 b4 |................|
00000b00 ad e2 80 8a e3 88 a0 e3 98 b3 e2 80 b5 e3 80 b2 |................|
00000b10 e3 a0 b0 e3 88 b0 e3 8c b1 e2 80 b2 e2 b8 b4 e3 |................|
00000b20 9c b0 e3 90 a0 e3 80 ae e0 b4 b7 0a e5 89 83 e3 |................|
00000b30 a9 83 e3 80 a0 e3 a5 b8 e4 8d 82 e2 80 b0 e4 99 |................|
00000b40 8d e5 98 a0 e2 b8 b1 e3 80 b8 e4 84 b1 e0 a8 8d |................|
00000b50 0a |.|
00000b51
---------------------------------------
MELAG Vacuklav 31-B
---------------------------------------
Programm : Universal-Programm
134�C verpackt
Datum : 15.03.2013
Uhrzeit : 17:45:30 (Start)
Charge Nr. : 3
---------------------------------------
Vorheizung 120.8 �C
AIN6: Leitwert 2 �S/cm
Programmschritt Druck Temperat. Zeit
bar �C min
Start 0.06 68.1 00:00
1.Fraktionierung
Evakuierung -0.92 66.4 02:29
Dampfeinlass 0.40 108.3 04:50
2.Fraktionierung
Evakuierung -0.82 68.5 07:03
Dampfeinlass 0.41 109.6 08:54
3.Fraktionierung
Evakuierung -0.82 70.9 11:50
Dampfeinlass 0.40 109.5 13:40
Druckaufbau 2.05 134.1 16:06
Steril. Beginn 2.05 134.1 16:06
Steril. Ende 2.20 136.0 21:36
Druckablass 0.20 105.2 22:35
Vakuum-Trocknen
Trocknen Beginn -0.30 92.1 22:49
Trocknungsdruck -0.84 81.5 24:47
Trocknungsdruck -0.87 83.4 26:47
Trocknungsdruck -0.89 80.2 28:47
Trocknungsdruck -0.90 77.6 30:47
Trocknungsdruck -0.90 76.1 32:47
Trocknungsdruck -0.91 75.1 34:47
Trocknungsdruck -0.91 74.4 36:47
Trocknungsdruck -0.91 74.1 38:47
Trocknungsdruck -0.91 73.8 40:47
Trocknungsdruck -0.91 73.6 42:47
Trocknen Ende -0.87 73.8 42:49
Bel�ften -0.27 75.9 43:00
Ende 0.00 76.9 43:12
---------------------------------------
PROGRAMM ERFOLGREICH ABGELAUFEN!
Temperatur : 135.9 +0.4 /-0.4 �C
Druck : 2.18 +0.04/-0.04 bar
Sterilisierzeit : 5 min 30 s
Uhrzeit : 18:28:42 (Ende)
---------------------------------------
2365 200802132 4.07 4.07
CRC: 0x9BC0 MF V1.801A
It looks like the source text was originally ISO/IEC 8859-1, a standard single-byte extended ASCII encoding. To produce that hex dump, some process misinterpreted the source text as UTF-16LE (a double-byte encoding) and converted it to UTF-8, which is why many programs you've tried interpreted it as UTF-8.
To manually reverse this process, decode the hex as UTF-8, swap every pair of bytes to account for the endianness, then interpret the resulting bytes as ISO/IEC 8859-1.

How to find running application size programatically in blackberry?

i want to find the size of running application of blackberry by code.I checked the how to find application size in blackberry by code? link but i am not getting answer. Please suggest me solution. Thanks in advance.
If you mean of size of running application that size of total cod files
then we can calculate.
when we instal application using JAD we can see the application size.
For example: my application name is PictureBackground
After successful sign in application we can take cod fils and jad file for devise installation. when we click on PictureBackground.jad then we can find following type of information
Name: PictureBackground
Version: 1.0.0
Vender: Blackberry Developer
Size: 513.4kb
If you want to pragmatically retrieve that size, then we can do it as following
we can find all information about application in PictureBackground.jad file
For example PictureBackground.jad file as follow:
RIM-COD-SHA1-4: ff 3c 2f ec 7b 6a 3d 1a e3 86 ec d2 87 0a c3 e1 6c f3 14 0e
RIM-COD-SHA1-3: 07 4d f7 db 9a f3 df 1d 00 90 b6 4f 54 f0 3a f0 c8 de ca b1
RIM-COD-SHA1-2: 95 14 4a 6a 7d 3a 1b db 2e 0f 05 b8 e1 ff 66 8a e0 ce f1 64
RIM-COD-SHA1-1: 68 a7 09 4e dc cf 2f c1 9b 43 d1 0b 35 b8 4b bc 35 72 ba 92
RIM-MIDlet-Flags-1: 0
MIDlet-Jar-Size: 591513
MIDlet-Name: PictureBackground
MIDlet-Jar-URL: PictureBackground.jar
MicroEdition-Configuration: CLDC-1.1
RIM-COD-URL-9: PictureBackground-9.cod
RIM-COD-URL-8: PictureBackground-8.cod
RIM-COD-URL-7: PictureBackground-7.cod
RIM-COD-Module-Dependencies: net_rim_cldc
RIM-COD-URL-6: PictureBackground-6.cod
RIM-COD-URL-5: PictureBackground-5.cod
RIM-COD-URL-4: PictureBackground-4.cod
RIM-COD-URL-3: PictureBackground-3.cod
RIM-COD-URL-2: PictureBackground-2.cod
RIM-COD-URL-1: PictureBackground-1.cod
RIM-COD-Size-9: 51288
RIM-COD-Size-8: 55284
RIM-COD-Size-7: 58560
RIM-COD-Size-6: 51340
RIM-COD-Size-5: 55748
RIM-COD-Size-4: 53000
RIM-COD-Size-3: 55084
RIM-COD-Module-Name: PictureBackground
RIM-COD-Size-2: 51284
RIM-COD-Size-1: 60448
RIM-COD-SHA1: 55 82 db c2 8c 44 73 c8 44 b6 ce 7f 20 bb 70 47 d2 df fe ab
RIM-COD-Size: 33688
MicroEdition-Profile: MIDP-2.0
MIDlet-Vendor: BlackBerry Developer
MIDlet-1: PictureBackground,,
RIM-COD-URL: PictureBackground.cod
Manifest-Version: 1.0
MIDlet-Version: 1.0.0
RIM-COD-SHA1-9: 76 04 75 59 21 27 c6 18 97 ed 49 fb ce 03 f3 21 fd 63 c1 96
RIM-COD-SHA1-8: 79 a9 b7 85 59 aa 06 e6 4b 76 89 de 12 cd 10 0d 54 93 48 dd
RIM-COD-SHA1-7: 3d d1 d1 47 e3 8d b5 9d 57 89 51 e3 a9 b3 77 5e c4 57 17 a8
RIM-COD-Creation-Time: 1327931490
RIM-COD-SHA1-6: f7 78 f7 b3 46 f5 69 91 9d 87 33 d0 a9 9d 9b 92 b6 de 90 74
RIM-COD-SHA1-5: 98 b3 45 64 8b 5f 36 0a aa c1 0e 2e 66 ea 7a f7 50 37 05 7a
Through this we can find the running application size
Sample code :
package samplecode;
import java.util.Enumeration;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.CodeModuleGroup;
import net.rim.device.api.system.CodeModuleGroupManager;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class StartUp extends UiApplication{
public static void main(String[] args) {
StartUp up=new StartUp();
up.enterEventDispatcher();
}
public StartUp()
{
MainScreen screen=new MainScreen();
CodeModuleGroup cmg = null;
CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll();
String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName();
for (int i = 0; i < allGroups.length; i++) {
if (allGroups[i].containsModule(moduleName)) {
cmg = allGroups[i];
break;
}
}
if (cmg == null) {
screen.add(new LabelField("not able to fetch properties"));
} else {
double size=0;
for (Enumeration e = cmg.getPropertyNames(); e
.hasMoreElements();) {
String name = (String) e.nextElement();
String value = cmg.getProperty(name);
if(name.indexOf("RIM-COD-Size")!=-1)
{
size=size+Double.parseDouble(value);
}
//add(new LabelField("Name: " + name));
}
screen.add(new LabelField("Size: " +(size/1024)+"kb"));
}
UiApplication.getUiApplication().pushScreen(screen);
}
}
NOTE: IT WONT WORK ON SIMULATOR, IT WORKS ON DEVISE(IT SHOULD BE INSTALL FROM JAD FILE) AND WE CAN FIND OUTPUT AS FOLLOWING
size:513.40234375KB

Problem with TRandomStream - Delphi TurboPower LockBox 3

I am using TurboPower LockBox 3 (http://sourceforge.net/projects/tplockbox/ and http://lockbox.seanbdurkin.id.au/tiki-index.php)
I have a problem with the TRandomStream. I'm trying to generate a chunk of 32 byte random data, but the output does not seem to be random.
The code is:
function StringToHex(S: String): String;
var I: Integer;
begin
Result:= '';
for I := 1 to length (S) do
Result:= Result+IntToHex(ord(S[i]),2)+' ';
end;
procedure TForm1.btn1Click(Sender: TObject);
const
Len = 32;
var
j,k: Integer;
P: Pointer;
Str: AnsiString;
begin
GetMem(P,Len);
TRandomStream.Instance.Randomize;
SetLength(Str,Len);
for j := 1 to 20 do
begin
TRandomStream.Instance.Read(P^,Len);
for k := 0 to Len-1 do
begin
Str[k+1]:=PAnsiChar(P)[k];
end;
mmoOutput.Lines.Add('> '+StringToHex(Str));
end;
FreeMem(P,Len);
end;
The output is:
> 91 79 00 77 FD F7 1C 51 22 64 BA 07 9F 87 8F B2 85 94 92 84 6B F7 5B 55 1A 0D DE E5 44 4A 56 DA
> A5 A6 C3 3D DB 01 69 61 5A 66 D8 ED 3F 3B 4D 00 A5 D7 CB 84 BB 40 CE 3E 5A 90 54 DD BF 63 0E 2C
> A5 5F 75 70 76 1F 08 25 5A E0 8D F0 9C 0B 15 F7 A5 9F C1 A7 F9 7C FF BA 5A 60 58 60 B5 97 F4 25
> A5 9F 23 E2 09 D2 74 52 5A 60 AC 5E 6E D8 B6 81 A5 9F 33 B5 2B B8 B5 15 5A 60 4C 51 96 DB 68 66
> A5 9F B3 4D 3A 51 4C 0D 5A 60 4C E6 D5 4C F8 83 A5 9F B3 11 AF 19 DB 2D 5A 60 4C 8E D2 D6 49 70
> A5 9F B3 31 55 5D D1 28 5A 60 4C CE B7 26 56 C8 A5 9F B3 31 86 7A 83 A0 5A 60 4C CE E1 A5 B8 E8
> A5 9F B3 31 0E 64 14 5E 5A 60 4C CE 31 9F CC EB A5 9F B3 31 4E B0 9B 4A 5A 60 4C CE B1 69 6C 04
> A5 9F B3 31 4E 12 D6 AE 5A 60 4C CE B1 BD 6A C9 A5 9F B3 31 4E 22 A9 D0 5A 60 4C CE B1 5D 5D F1
> A5 9F B3 31 4E A2 41 DF 5A 60 4C CE B1 5D F2 30 A5 9F B3 31 4E A2 05 54 5A 60 4C CE B1 5D 9A 2D
> A5 9F B3 31 4E A2 25 FA 5A 60 4C CE B1 5D DA 12 A5 9F B3 31 4E A2 25 2B 5A 60 4C CE B1 5D DA 3C
> A5 9F B3 31 4E A2 25 B3 5A 60 4C CE B1 5D DA 8C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
> A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C A5 9F B3 31 4E A2 25 F3 5A 60 4C CE B1 5D DA 0C
Which does not seem to be random.
What am I doing wrong?
Thanks and regards.
OK. I've found the problem and a fix. Procedure TRandomStream.Crunch uses Compiler Version switching:
For Compiler Version > 17
FValue := FValue * Factor + 1 ;
Whilst for Compiler Version <= 17 (which is my case), the use of the function SquarePlus1Int64_NoOverflowChecks equates to:
FValue := FValue * FValue + 1;
To fix change:
function SquarePlus1Int64_NoOverflowChecks(Factor: int64): int64;
begin
result := Factor * Factor + 1
end;
to
function MultiplyPlus1Int64_NoOverflowChecks(Value,Factor: int64): int64;
begin
result := Value * Factor + 1
end;
and in TRandomStream.Crunch change:
FValue := SquarePlus1Int64_NoOverflowChecks(FValue);
to
FValue := MultiplyPlus1Int64_NoOverflowChecks(FValue, Factor);

Resources