Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Delphi DLL Examples

Web API Categories

ASN.1
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
NTLM
OAuth1
OAuth2
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
PDF Signatures
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Delphi DLL) Generating Random Password

Demonstrates how to generate random passwords.

Chilkat for Delphi Downloads

Chilkat non-ActiveX DLL for Delphi

Chilkat ActiveX DLL for Delphi

* The examples here use the non-ActiveX DLL.

uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Prng, Global;

...

procedure TForm1.Button1Click(Sender: TObject);
var
chilkatGlob: HCkGlobal;
success: Boolean;
fortuna: HCkPrng;
bDigit: Boolean;
bUpperAndLower: Boolean;
otherChars: PWideChar;
excludeChars: PWideChar;
i: Integer;

begin
//  All Chilkat classes can be unlocked at once at the beginning of a program
//  by calling UnlockBundle.  It requires a Bundle unlock code.
chilkatGlob := CkGlobal_Create();
success := CkGlobal_UnlockBundle(chilkatGlob,'Anything for 30-day trial.');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkGlobal__lastErrorText(chilkatGlob));
    Exit;
  end;

fortuna := CkPrng_Create();

//  Set this equal to True if the generated password must include at least one digit (0-9)
bDigit := True;

//  Set this equal to True if the generated password must include both uppercase and lowercase chars.
bUpperAndLower := True;

//  The generated password must contain one of the following non-alphanumeric chars.
otherChars := '@#$%*';

//  Exclude chars that appear similar to others:
excludeChars := 'iIlLoO0';

//  Generate 8-character passwords:

for i := 1 to 10 do
  begin
    Memo1.Lines.Add(CkPrng__randomPassword(fortuna,8,bDigit,bUpperAndLower,otherChars,excludeChars));
  end;

CkGlobal_Dispose(chilkatGlob);
CkPrng_Dispose(fortuna);

end;

 

© 2000-2021 Chilkat Software, Inc. All Rights Reserved.