Re: [Lazarus] Encryption compatible with .net

2015-11-15 Thread payl
I see another problem: Your pascal implementation sets key badly. I think  
it should be 'key'[1]. However as I didn't even use buffer with constant  
string so I might be wrong.
You should also try to encrypt longer messages to see if first block is  
intact because then it's padding problem.
Please also note that such implementation is insecure because IV is  
static, key isn't derived with KDF, DES is insecure nowadays, and no  
integrity checking is done. So if you want your encryption to be of any  
security, fix these flaws.
Also consider cleaning up code so we don't get confused about unused  
variables.


(Btw. My first post on this mailing list - yay!)

W dniu .11.2015 o 12:56 Gabriele Cappelletto  
 pisze:


But the cipther constructor does not refer to vector, but the variable  
IV. Vector is not used in this example


Il 15/11/2015 12:44, DougC ha scritto:

After quick look I noticed that

var
 Vector : array of Byte;

 SetLength(Vector, 8);
 Vector[0] := 1;
 Vector[1] := 2;
 Vector[2] := 3;
 Vector[3] := 4;
 Vector[4] := 5;
 Vector[5] := 6;
 Vector[6] := 7;
 Vector[7] := 8;

does not match

 Dim vector As String = "12345678"

Should be something like
 Vector[0] := '1';
 Vector[1] := '2';
 Vector[2] := '3';
 Vector[3] := '4';
 Vector[4] := '5';
 Vector[5] := '6';
 Vector[6] := '7';
 Vector[7] := '8';

I didn't look at the rest.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Questions about SetLength

2014-09-12 Thread payl

Hi,

Maybe it is not a correct list, but I am going to ask my question anyway  
:)


Is there a penalty for calling SetLength if array already has the length  
we need?
Yes, there's always penalty for operations that you don't need. FPC will  
generate normal call, pass arguments, etc. I checked if SetLength with  
ansistring detects that requested size is same: It doesn't, it performs  
whole allocation and moving.


And if there is a penalty - is there a way to write "generic" function  
SmartSetLength(array,length) that will only call SetLength if necessary?
No. Compiler internally emits information about element size, how are they  
refcounted etc. as a pointer. Your best bet would be "hacking" FPC to emit  
such information to your procedure and then pass it to internal fpc  
setlength.
I would personally like it a lot if there was way to access "secret"  
information stored along with dynamic arrays/ansistrings, however it's not  
easy task. I think best bet would be storing secret information pointers  
along with refcount/length and then making functions that allow editing  
those data. Then we could have generic "dynamic array" type (I assume?).


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Code completion problems with Graph units

2014-09-10 Thread payl

On 10.09.2014 07:52, Sven Barth wrote:

Nope... moving the "graph" node up does not change anything *sigh*

(Warning: No nice solutions here)
Well I would first try if CodeTools are just unable to find inc file, so I  
would try to move/copy include file so CodeTools can find it. You noted  
that sometimes It tells you it's unable to find end of file: Maybe  
conditionals make CodeTools ignore rest of file? You could try messing  
with predefined conditionals. Or bruteforce solution: Manually include inc  
file and then test if everything works.
I wouldn't be surprised if CodeTools couldn't parse this file due to some  
bug in parsing, there are still some notable bugs there.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TListBox Find method?

2014-08-26 Thread payl
Why not to implement a Find method for TListBox which allows partial  
search? Delphi missed it, but why Lazarus does the same?


I'd say that you cannot find something in TListBox which is visual object.  
You can search something in items it has, therefore you use  
"Items.Indexof". Then you only need to take care of how TStringList works  
and TListBox is unimportant. So it will be easier to deal with than if we  
had custom implementations of containters for all types of visual  
interfaces like TEdit, TMemo etc... Moreover if we will implement  
DeleteMany for example, we will only have to update TStringList, not  
TEdit/TMemo/TListbox.
Only argument against such thing is case where you have to use many  
characters to represent same thing. So we have "with" construction...--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where do lazarus apps look for dll's?

2014-08-01 Thread payl



Linux uses ELF, not PE/COFF.

You are correct, I mistaken COFF from Unix with ELF. In ELF there is  
simply e_ident[EI_CLASS] at offset 4 and e_machine at offset $12. Source:  
http://en.wikipedia.org/wiki/Executable_and_Linkable_Format


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where do lazarus apps look for dll's?

2014-08-01 Thread payl
(How) can the calling program know about the "bittiness" of a dll / so  
it tries to load ?

http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx

There is just field that tells what is architecture of file. This applies  
both to EXE and DLL.
You can see msdn has x86,x64 and itanium there, but there are many more  
existing.

In Linux situation is same, it also uses COFF and this field (AFAIK).

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus