fundamentalslib / fundamentals5 Goto Github PK
View Code? Open in Web Editor NEWFundamentals 5 Code Library for FreePascal and Delphi
Fundamentals 5 Code Library for FreePascal and Delphi
I have a Delphi 7 project (an RSA encrypt/decrypt demo) using fundamentals release v5.0.4 source code. It compiles and works OK.
Then I see new release v5.0.5 became public, so I try the same project using release v5.0.5 source code but It does not compile anymore.
Here the messages log from Delphi 7 compiler:
[Error] flcHash.pas(1089): Undeclared identifier: 'UnicodeString'
[Error] flcHash.pas(1334): Overloaded procedure 'CalcXOR8' must be marked with the 'overload' directive
[Error] flcHash.pas(1347): Overloaded procedure 'CalcXOR16' must be marked with the 'overload' directive
[Error] flcHash.pas(1357): Overloaded procedure 'CalcXOR32' must be marked with the 'overload' directive
[Error] flcHash.pas(1431): Overloaded procedure 'CalcCRC16' must be marked with the 'overload' directive
[Error] flcHash.pas(1525): Overloaded procedure 'CalcCRC32' must be marked with the 'overload' directive
[Error] flcHash.pas(1584): Overloaded procedure 'CalcAdler32' must be marked with the 'overload' directive
[Error] flcHash.pas(1622): Overloaded procedure 'CalcELF' must be marked with the 'overload' directive
[Error] flcHash.pas(2386): Overloaded procedure 'CalcMD5' must be marked with the 'overload' directive
[Error] flcHash.pas(2559): Overloaded procedure 'CalcSHA1' must be marked with the 'overload' directive
[Error] flcHash.pas(2638): Overloaded procedure 'CalcSHA224' must be marked with the 'overload' directive
[Error] flcHash.pas(2807): Overloaded procedure 'CalcSHA256' must be marked with the 'overload' directive
[Error] flcHash.pas(2888): Overloaded procedure 'CalcSHA384' must be marked with the 'overload' directive
[Error] flcHash.pas(3163): Overloaded procedure 'CalcSHA512' must be marked with the 'overload' directive
[Error] flcHash.pas(3490): Overloaded procedure 'CalcRipeMD160' must be marked with the 'overload' directive
[Error] flcHash.pas(3635): Overloaded procedure 'CalcHMAC_MD5' must be marked with the 'overload' directive
[Error] flcHash.pas(3640): Overloaded procedure 'CalcHMAC_MD5' must be marked with the 'overload' directive
[Error] flcHash.pas(3710): Overloaded procedure 'CalcHMAC_SHA1' must be marked with the 'overload' directive
[Error] flcHash.pas(3715): Overloaded procedure 'CalcHMAC_SHA1' must be marked with the 'overload' directive
[Error] flcHash.pas(3785): Overloaded procedure 'CalcHMAC_SHA256' must be marked with the 'overload' directive
[Error] flcHash.pas(3790): Overloaded procedure 'CalcHMAC_SHA256' must be marked with the 'overload' directive
[Error] flcHash.pas(3860): Overloaded procedure 'CalcHMAC_SHA512' must be marked with the 'overload' directive
[Error] flcHash.pas(3865): Overloaded procedure 'CalcHMAC_SHA512' must be marked with the 'overload' directive
[Error] flcHash.pas(207): Unsatisfied forward or external declaration: 'DigestToHexBufA'
[Error] flcHash.pas(212): Unsatisfied forward or external declaration: 'DigestToHexA'
[Fatal Error] flcCipherRSA.pas(63): Could not compile used unit 'Utils\flcHash.pas'
Did you test this new release using Delphi 7 ?
Am I missing any extra step in order to get fundamentals release v5.0.5 working using Delphi 7 ?
This fails on Linux because this function result -
fundamentals5/Source/Sockets/flcSocketLib.pas
Lines 1810 to 1814 in 9a07862
Is only defined for Windows -
fundamentals5/Source/Sockets/flcSocketLib.pas
Lines 474 to 476 in 9a07862
fpc 3.3 r40721 does not like it when function arguments have the same name as a property
flcDataStructs.pas(343,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(344,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(378,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(379,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(384,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(420,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(421,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(426,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(471,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(472,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(477,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(513,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(514,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(519,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(564,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(565,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(570,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(606,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(607,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(612,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(648,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(649,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(654,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(690,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(691,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(696,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(733,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(734,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(739,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(776,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(777,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(782,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(824,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(825,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(830,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(863,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(864,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(869,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(905,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(906,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(911,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(944,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(945,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(950,31) Error: Duplicate identifier "Count"
flcDataStructs.pas(987,48) Error: Duplicate identifier "Count"
flcDataStructs.pas(996,27) Error: Duplicate identifier "Item"
flcDataStructs.pas(996,48) Error: Duplicate identifier "ClassType"
flcDataStructs.pas(997,27) Error: Duplicate identifier "Item"
flcDataStructs.pas(997,48) Error: Duplicate identifier "ClassName"
flcDataStructs.pas(998,26) Error: Duplicate identifier "ClassType"
flcDataStructs.pas(998,26) Verbose: There were 50 errors compiling module, stopping
Is this library cross platform and can it be used in FMX apps? I am interested in using it on OSX.
I can see there are defines for UNIX but not sure whether they work on OSX
Hi,
Can you provide an example about how to use TDoublyLinkedList?
This is what I have so far:
var list: TDoublyLinkedList:=TDoublyLinkedList.Create;
list.Append(TDoublyLinkedString.Create('1'));
var ni:TDoublyLinkedString:=TDoublyLinkedString.Create('2');
ni.Append('2.1');
ni.Append('2.2');
list.Append(ni);
list.free;
How do I iterate through the elements?
I'd like to produce the following output:
1
2 - 2.1 - 2.2
is not completed yet?
in flcHTMLElements.pas
in function htmlGetTagIDPtrA();
this portion
CompareMemNoAsciiCase(Name^, Pointer(P^.Name)^, NameLen)
should be
CompareMemNoAsciiCase(Name^, Pointer(AnsiString(P^.Name))^, NameLen)
and similarly, in function htmlGetAttrIDPtrA()
this portion
CompareMemNoAsciiCase(Name^, Pointer(htmlAttributeTable[Result])^, NameLen)
should be
CompareMemNoAsciiCase(Name^, Pointer(AnsiString(htmlAttributeTable[Result]))^, NameLen)
Otherwise, CompareMemNoAsciiCase() fails.
Could you please add those typecasts.
How?
Can you please explain how to use dh with known prime?
Hi,
I have generated my root ca, imported it as trusted ca.
I then have generated a server cert (signed by my root ca) : so far so good, my windows is happy with my cert (cert path, etc).
Now, I set up a https server with fundamentals5 and use http_srv.TCPServer.TLSServer.PEMFileName :='full.pem'; //contains cert and private key
When connecting to my https server (with different browsers), it fails.
Client hello, server hello, cert exchange and key exchange take place but client sends back an alert.
My issue is the following : I can observe that the key exchange is tagged as malformed packet in wireshark (key len = 0).
Screenshot here [https://i.imgur.com/CGO7mHD.png] .
I tried to generate my ca & cert with sha1 and sha2 : no success.
I tried ssl3 to tls1.2 : no success.
I tried setting PrivateKeyRSAPEM and TLSCertificateListAppend (rather than using a cert file) : no success.
Anything I am doing wrong / missing or is there a bug in the code?
I can share my root ca and cert if needed (all local with openssl).
The same cert works fine with a similar code with Indy 10
Regards,
Erwan
my code
begin
http_srv:=TF5HTTPServer.Create(nil);
http_srv.OnPrepareResponse := onSrvPrepareResponse;
http_srv.OnResponseComplete:=onSrvResponseComplete;
http_srv.AddressFamily := safIP4;
http_srv.ServerPort :=4443;
http_srv.OnLog :=onSrvLogEvent;
//http_srv.TCPServer.OnLog := onTCPServerLogEvent;
//define tls in flcTCP.inc and define http_tls in flcHTTP.inc
if chktls.Checked then
begin
//http_srv.HTTPSOptions:=[ssoDontUseTLS12,ssoDontUseTLS11,ssoDontUseTLS10 ];
http_srv.TCPServer.TLSServer.PEMFileName :='full.pem';
http_srv.TCPServer.TLSServer.OnLog :=onTLSServerLogEvent;
http_srv.HTTPSEnabled :=true;
end;
http_srv.Active :=true;
Assert(http_srv.Active);
end;
Hello!
Thank you for a great library!
I found a bug in the functions HugeWordAssignBufStrB and HugeWordAssignBufStr
it adds 0x013F00 to the short buffers
How to repeat:
pass a single byte buffer to the function, e.g., #1
A "patch" that fixes the problem (just add zeros)
raw := StringOfChar(#0,3) + raw;
HugeWordAssignBufStrB(BN, raw, True);
Hello, i didn't find any information about http client component.
So the question is: how to set HTTPS connection as example for "google.com"?
I tried to change "usehttps" property, but this no helps.
Is there any documentation beyond staring at source code?
Unit flcStreams
AReaderEx.Match contains a call to CompareMemNoAsciiCase
This is listed in the documentation but doesn't exist.
CompareMemNoAsciiCaseB and CompareMemNoAsciiCaseW do exist.
My project won't compile and I don't want to guess which to use and start changing code I don't understand :)
Hi,
I was looking at the datetime util but couldn't find any methods to do what I need.
Is there a method to convert natural language date/time to TDateTime?
For example, for the input "3hrs and 5mins" to produce the relevant TDateTime?
Thanks
Can add fast CRC32 or fast crc64 functons?
Hello!
In advance, sorry for my poor english.
In accordance with the specifications of JSON (see http://www.json.org/), about Number type.
Number is:
It is a double precision floating-point format in JavaScript (Octal and hexadecimal formats are not used).
...
In accordance with the definition, the DOT (".") must be used as the decimal separator. In your implementation of JSON (in flcJson.pas), you use FloatToStr and StrToFloat function, which as a decimal value used Delphi DecimalSeparator global constant, which contradicts the requirements of the JSON specification. For example, in Russia as DecjmalSeparator used COMMA, therefore your flcJson module in Russia can not be used.
In accordance with the foregoing, I propose:
function FloatToStrDot (aValue: extended): string;
var
fFormatSettings : TFormatSettings;
begin
GetLocaleFormatSettings (GetThreadLocale, fFormatSettings);
fFormatSettings.DecimalSeparator := '.';
Result := FloatToStr (aValue, fFormatSettings);
end;
function StrToFloatDot (aValue : string) : Extended;
var
fDummy : Integer;
begin
Val(aValue, Result, fDummy);
if fDummy <> 0 then
raise Exception.CreateFmt('Invalid float value: "%s"', [aValue]);
end;
Regards,
Malinovsky Vladimir.
hello
how can i install and use this component on delphi xe 10.2 ?!
thank you
Hi, I'm trying to import a GTFS Realtime Protobuf, but there are various errors (unknown "syntax" key, field cardinality expected, etc.). Can you try processing the file "https://developers.google.com/transit/gtfs-realtime/gtfs-realtime.proto"? Thank you.
Hi,
I used some of your code to make some very good dictionaries in one of my apps.
Thank you very much.
Now I have a different situation: dictionaries for multiple (automated/confirmation) find&replace.
They can be strings of any kind: Any (upcase/lowcase) letter, number 0..9 or even chars not found in words.
Usualy there are a large number of searches on large rtfs - and only a few replacements.
So it seems a text hashing (instead of dictionary key hashing) would be a lot faster.
Do you have some advices/hints on how to do that?
Thank you.
Kind regards,
Cosmin
Wanted to compile and newly introduced html parser and run flcHTMLTest.pas, but got error as the following:
[dcc32 Error] flcUtils.pas(2279): E2003 Undeclared identifier: 'UTF8Char'
It's XE4 and it does support utf-8 and I can see the following in flcInclude.inc, so not sure why this compilation error happens. I did try manually adding SupportUTF8Char to the newly-created, almost-empty project's Conditional Defines, still getting the same error.
Any hints? Thanks.
{$IFDEF DELPHIXE4_UP}
{$DEFINE SupportUTF8Char}
BTW, does the parser supports full html5 spec?
does the parsed info contain position info?
flcCipherDH references flcASN1, than isn't in the package. I look everywhere but didn't find it.
for example {"Value":-0.01000} will return 0.01. Negative sign will be lost due to code:
var C : WideChar;
N : Boolean;
begin
..
if N then
Result := -Result; // if Result=0, the minus sign will be lost
end;
Error detection:
uses
flcDataStructs;
var
fD : TStringDictionary;
fStr: string;
begin
fD := TStringDictionary.Create;
fD['1234'] := '567';
fStr := fD.AsString; // raised exception "Method TStringDictionary.GetItemStrByIndex not implemented"
Solution:
Solution:
It should be in the protected section of class AStringDictionary add overridden method:
type
AStringDictionary = class(ADictionary)
protected
...
function GetItemStrByIndex(const Idx: Integer): String; override; // Added
with the implementation:
function AStringDictionary.GetItemStrByIndex(const Idx: Integer): String;
begin
Result := GetItemByIndex(Idx);
end;
Regards, Malinovsky Vladimir.
when support delphi 10.2 Linux X64?
Hi, I am using flcCipherRSA (fundamentals5 v5.0.4).
Here, I manage PublicKeys and PrivateKeys in terms of KeySize Modulus & Exponent.
However, when somebody provides me a key , they give me a PEM File.
I know I can use openssl command line tool this way:
Get key size, modulus, public exponent & private exponent, (private.pem contains a RSA PRIVATE KEY)
openssl rsa -in private.pem -text
Get key size, modulus, public exponent, (public.pem contains a RSA PUBLIC KEY)
openssl rsa -pubin -inform PEM -text -noout < public.pem
So, here my question:
Is there an easy way to get key size, modulus, public exponent, private exponent from a PEM file using fundamental5 library ?
FYI: I'm using fundamentals v5.0.4 and Delphi 7. (I see some functions related to PEM management in TLS unit (v5.0.5) but I don't really know they cover my needs and eventually I can not use because v5.0.5 is not actually been testes with Delphi 7)
Hi guys,
I can produce documentation for the whole library like this: http://docs.casbin4d.kouraklis.com/
Would you be interested to add it in the repo?
Thanks
Hello, flcSocksClient.pas is missing
I think, there is a bug in HugeWordAssignBuf() at the end of the procedure. Here is a modified version with some explanations:
procedure HugeWordAssignBuf(var A: HugeWord; const Buf; const BufSize{Bytes}: Integer; const ReverseByteOrder: Boolean);
//* The for cycle high value when filling the end of A.Data buffer with zeroes. -1 means no fill, 0 means 1 byte fill.
const FillCount: array[0..HugeWordElementSize-1] of Integer = (-1, 2, 1, 0);
var {L}ElemCount, I : Integer;
P, Q : PByte;
begin
if BufSize <= 0 then
HugeWordAssignZero(A)
else
begin
{L}ElemCount := (BufSize{Bytes} + HugeWordElementSize{Bytes} - 1) div HugeWordElementSize{Bytes};
HugeWordSetSize_NoZeroMem(A, {L}ElemCount);
//* Copy number of BufSize bytes from Buf to A.Data
P := @Buf;
Q := A.Data;
if ReverseByteOrder then
Inc(P, BufSize{Bytes} - 1);
//* For example BufSize = 3, ElemCount = 1, this is a 4 byte buffer.
//* It copies bytes at position 0, 1, 2
for I := 0 to BufSize{Bytes} - 1 do
begin
Q^ := P^;
Inc(Q);
if ReverseByteOrder then
Dec(P)
else
Inc(P);
end;
//* Fill the remaining bytes with zeroes in A.Data
(* Original code
//* In the above example, Q points to position 3, and the cycle should run once.
//* But 3 mod 4 - 1 = 2, and the cycle will run 3 times, causing memory corruption above the allocated buffer.
for I := 0 to BufSize{Bytes} mod 4{HugeWordElementSize} - 1 do
begin
Q^ := 0;
Inc(Q);
end;
*)
//* Modified code
for I := 0 to FillCount[BufSize{Bytes} mod HugeWordElementSize] do
begin
Q^ := 0;
Inc(Q);
end;
end;
end;
Hi.
Protobuf is no longer supported?
flcHugeInt contains no addition function for directly passed 64-bit integers (signed or unsigned).
By contrast, flcInteger contains operations like WordXXAddWord64 for all integer word types and is able to operate even on typecasted 64-bit variables. Could such functionality be implemented in flcHugeInt too?
I try to compile this project & find this issue.
message field can be optional too - you probably want to move this HasValue := false block before the if statement
flcHugeInt has serious performance degradation in comparison with version 4. RSA 4096-bit keys generation take about 30 sec. using cHugeInt (version 4) and more than 3 minutes with flcHugeInt (current version). Generation 8192-bit keys take about 3 minutes using cHugeInt (version 4) and more then 3 hours with flcHugeInt (current version). In my test i used equal entropy source for both versions.
Trying to generate code for VoxPbMonitoringProtocol.proto from http://developer.voxtron.com/?page_id=262 I get the following error:
Error: VoxPbMonitoringProtocol.proto(8): VoxPbCommonProtocol.proto(256): Identifier expected
VoxPbCommonProtocol.proto is an import and is also present in the directory.
I tried it with the google supplied protoc for C++ and it generated code, so I assume the .proto file itself is valid.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.