Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Classic ASP Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
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
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

SHA-1 Hash a String (XML Document)

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

ASP example to SHA-1 hash an XML document.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set crypt = Server.CreateObject("Chilkat_9_5_0.Crypt2")

'  Any string argument automatically begins the 30-day trial.
success = crypt.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "Crypt component unlock failed" & "<br>"

End If

xmlDoc = "<test><a>123</a><b>456</b><c>789</c></test>"

'  This example was created in response to a request to
'  do this:
'  XML-->byte[]-->SHA-1(byte[])-->Base64(string)

'  The output will be Base64, so set the EncodingMode:
crypt.EncodingMode = "base64"

'  It is desired to hash bytes.  Depending on the programming
'  language, strings may be Unicode (2 bytes/char).  We don't
'  want to hash Unicode.  By setting the Charset property,
'  we're telling the encryption component to first convert
'  a string to the multibyte charset indicated.
crypt.Charset = "windows-1252"

'  Set the hash algorithm:
crypt.HashAlgorithm = "sha-1"

'  Hash the string:
'  Internally, this converts the string to bytes, hashes the bytes,
'  and converts the hash bytes to a Base64 encoded string:

'  Note: Any method in Chilkat Crypt that ends with "ENC" returns the
'  output bytes (i.e. hashed or encrypted) as an encoded string
'  according to the EncodingMode property, which can be "base64",
'  "hex", "url", "quoted-printable", or "html" (for HTML entities).
hashStr = crypt.HashStringENC(xmlDoc)

Response.Write Server.HTMLEncode( hashStr) & "<br>"
%>
</body>
</html>

 

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