diff options
| author | ivost <ivost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-04-19 12:18:18 +0000 |
|---|---|---|
| committer | ivost <ivost@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-04-19 12:18:18 +0000 |
| commit | d30720ab7d2400532370c56788a649a30ac824c9 (patch) | |
| tree | 3f300a97078992b5a90657acbbb6050a59ea31d8 /packages/hash | |
| parent | 53af41b84768a5d56665d72e53a4b90e5710733f (diff) | |
| download | fpc-d30720ab7d2400532370c56788a649a30ac824c9.tar.gz | |
* implemented uuid_create_sha1_from_name
* changed some var to out parameters (so that there's no not initialized warning)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15153 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/hash')
| -rw-r--r-- | packages/hash/Makefile | 149 | ||||
| -rw-r--r-- | packages/hash/Makefile.fpc | 2 | ||||
| -rw-r--r-- | packages/hash/src/sha1.pp | 8 | ||||
| -rw-r--r-- | packages/hash/src/uuid.pas | 50 |
4 files changed, 117 insertions, 92 deletions
diff --git a/packages/hash/Makefile b/packages/hash/Makefile index f688281a93..546a608120 100644 --- a/packages/hash/Makefile +++ b/packages/hash/Makefile @@ -1,8 +1,8 @@ # -# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/12/10] +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/04/16] # default: all -MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux +MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux BSDs = freebsd netbsd openbsd darwin UNIXs = linux $(BSDs) solaris qnx haiku LIMIT83fs = go32v2 os2 emx watcom @@ -267,184 +267,187 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(F override PACKAGE_NAME=hash override PACKAGE_VERSION=2.5.1 ifeq ($(FULL_TARGET),i386-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),i386-go32v2) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-win32) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-os2) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-freebsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-beos) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-haiku) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-netbsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-solaris) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-qnx) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-netware) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-openbsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-wdosx) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-darwin) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-emx) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-watcom) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-netwlibc) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-wince) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),i386-symbian) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid +endif +ifeq ($(FULL_TARGET),i386-nativent) +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),m68k-freebsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-netbsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-amiga) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-atari) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-openbsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-palmos) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),m68k-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),powerpc-netbsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc-amiga) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc-macos) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc-darwin) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc-morphos) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),sparc-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),sparc-netbsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),sparc-solaris) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),sparc-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),x86_64-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),x86_64-freebsd) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),x86_64-solaris) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),x86_64-darwin) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),x86_64-win64) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),x86_64-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),arm-palmos) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-darwin) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-wince) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-gba) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-nds) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),arm-symbian) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc64-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),powerpc64-darwin) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),powerpc64-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),avr-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),armeb-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),armeb-embedded) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 +override TARGET_UNITS+=md5 crc ntlm sha1 uuid endif ifeq ($(FULL_TARGET),mipsel-linux) -override TARGET_UNITS+=md5 crc ntlm uuid sha1 unixcrypt +override TARGET_UNITS+=md5 crc ntlm sha1 uuid unixcrypt endif ifeq ($(FULL_TARGET),i386-linux) override TARGET_EXAMPLEDIRS+=examples @@ -506,6 +509,9 @@ endif ifeq ($(FULL_TARGET),i386-symbian) override TARGET_EXAMPLEDIRS+=examples endif +ifeq ($(FULL_TARGET),i386-nativent) +override TARGET_EXAMPLEDIRS+=examples +endif ifeq ($(FULL_TARGET),m68k-linux) override TARGET_EXAMPLEDIRS+=examples endif @@ -687,6 +693,9 @@ endif ifeq ($(FULL_TARGET),i386-symbian) override COMPILER_SOURCEDIR+=src endif +ifeq ($(FULL_TARGET),i386-nativent) +override COMPILER_SOURCEDIR+=src +endif ifeq ($(FULL_TARGET),m68k-linux) override COMPILER_SOURCEDIR+=src endif @@ -1149,6 +1158,10 @@ ifeq ($(OS_TARGET),symbian) SHAREDLIBEXT=.dll SHORTSUFFIX=symbian endif +ifeq ($(OS_TARGET),NativeNT) +SHAREDLIBEXT=.dll +SHORTSUFFIX=nativent +endif else ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 @@ -1634,6 +1647,9 @@ endif ifeq ($(FULL_TARGET),i386-symbian) REQUIRE_PACKAGES_RTL=1 endif +ifeq ($(FULL_TARGET),i386-nativent) +REQUIRE_PACKAGES_RTL=1 +endif ifeq ($(FULL_TARGET),m68k-linux) REQUIRE_PACKAGES_RTL=1 endif @@ -2198,6 +2214,9 @@ fpc_zipdistinstall: ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif +ifdef CLEAN_PROGRAMS +override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS))) +endif ifdef CLEAN_UNITS override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif @@ -2245,6 +2264,9 @@ ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif -$(DELTREE) units -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) ifneq ($(PPUEXT),.ppu) @@ -2427,6 +2449,9 @@ endif ifeq ($(FULL_TARGET),i386-symbian) TARGET_EXAMPLEDIRS_EXAMPLES=1 endif +ifeq ($(FULL_TARGET),i386-nativent) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif ifeq ($(FULL_TARGET),m68k-linux) TARGET_EXAMPLEDIRS_EXAMPLES=1 endif diff --git a/packages/hash/Makefile.fpc b/packages/hash/Makefile.fpc index a043841f09..3a529cf2cf 100644 --- a/packages/hash/Makefile.fpc +++ b/packages/hash/Makefile.fpc @@ -7,7 +7,7 @@ name=hash version=2.5.1 [target] -units=md5 crc ntlm uuid sha1 +units=md5 crc ntlm sha1 uuid units_linux=unixcrypt exampledirs=examples diff --git a/packages/hash/src/sha1.pp b/packages/hash/src/sha1.pp index 5beaed2236..4180881628 100644 --- a/packages/hash/src/sha1.pp +++ b/packages/hash/src/sha1.pp @@ -29,9 +29,9 @@ type end; { core } -procedure SHA1Init(var ctx: TSHA1Context); +procedure SHA1Init(out ctx: TSHA1Context); procedure SHA1Update(var ctx: TSHA1Context; const Buf; BufLen: PtrUInt); -procedure SHA1Final(var ctx: TSHA1Context; var Digest: TSHA1Digest); +procedure SHA1Final(var ctx: TSHA1Context; out Digest: TSHA1Digest); { auxiliary } function SHA1String(const S: String): TSHA1Digest; @@ -61,7 +61,7 @@ begin end; end; -procedure SHA1Init(var ctx: TSHA1Context); +procedure SHA1Init(out ctx: TSHA1Context); begin FillChar(ctx, sizeof(TSHA1Context), 0); ctx.State[0] := $67452301; @@ -201,7 +201,7 @@ const 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ); -procedure SHA1Final(var ctx: TSHA1Context; var Digest: TSHA1Digest); +procedure SHA1Final(var ctx: TSHA1Context; out Digest: TSHA1Digest); var Length: QWord; Pads: Cardinal; diff --git a/packages/hash/src/uuid.pas b/packages/hash/src/uuid.pas index 15046d033a..48d6b7f467 100644 --- a/packages/hash/src/uuid.pas +++ b/packages/hash/src/uuid.pas @@ -21,7 +21,7 @@ interface {$h+} uses - SysUtils, DateUtils, md5; + SysUtils, DateUtils, md5, sha1; @@ -87,16 +87,16 @@ const procedure uuid_initialize(const state: uuid_state); { uuid_create -- generator a UUID } -function uuid_create(var uuid: uuid_t): boolean; +function uuid_create(out uuid: uuid_t): boolean; { uuid_finalize -- returns the current state } -procedure uuid_finalize(var state: uuid_state); +procedure uuid_finalize(out state: uuid_state); { uuid_create_md5_from_name -- create a version 3 (MD5) UUID using a "name" from a "name space" } -procedure uuid_create_md5_from_name(var uuid: uuid_t; const nsid: uuid_t; const name: string); +procedure uuid_create_md5_from_name(out uuid: uuid_t; const nsid: uuid_t; const name: string); { uuid_create_sha1_from_name -- create a version 5 (SHA-1) UUID using a "name" from a "name space" } -procedure uuid_create_sha1_from_name(var uuid: uuid_t; const nsid: uuid_t; const name: string); +procedure uuid_create_sha1_from_name(out uuid: uuid_t; const nsid: uuid_t; const name: string); { uuid_compare -- Compare two UUID's "lexically" } function uuid_compare(const u1, u2: uuid_t): integer; @@ -108,19 +108,19 @@ function uuid_compare(const u1, u2: uuid_t): integer; ******************************************************************************) { read_state -- read UUID generator state from non-volatile store } -function read_state(var clockseq: unsigned16; var timestamp: uuid_time_t; var node: uuid_node_t): boolean; +function read_state(out clockseq: unsigned16; out timestamp: uuid_time_t; out node: uuid_node_t): boolean; { write_state -- save UUID generator state back to non-volatile storage } procedure write_state(var clockseq: unsigned16; const timestamp: uuid_time_t; const node: uuid_node_t); { format_uuid_v1 -- make a UUID from the timestamp, clockseq, and node ID } -procedure format_uuid_v1(var uuid: uuid_t; const clockseq: unsigned16; const timestamp: uuid_time_t; const node: uuid_node_t); +procedure format_uuid_v1(out uuid: uuid_t; const clockseq: unsigned16; const timestamp: uuid_time_t; const node: uuid_node_t); { format_uuid_v3or5 -- make a UUID from a (pseudo)random 128-bit number } -procedure format_uuid_v3or5(var uuid: uuid_t; const hash: pointer; const v: integer); +procedure format_uuid_v3or5(out uuid: uuid_t; const hash: pointer; const v: integer); { get_current_time -- get time as 60-bit 100ns ticks since UUID epoch. Compensate for the fact that real clock resolution is less than 100ns. } -procedure get_current_time(var timestamp: uuid_time_t); +procedure get_current_time(out timestamp: uuid_time_t); @@ -129,7 +129,7 @@ procedure get_current_time(var timestamp: uuid_time_t); ******************************************************************************) { get_system_time -- system dependent call to get the current system time. Returned as 100ns ticks since UUID epoch, but resolution may be less than 100ns. } -procedure get_system_time(var timestamp: uuid_time_t); +procedure get_system_time(out timestamp: uuid_time_t); { true_random -- generate a crypto-quality random number. } function true_random: unsigned16; @@ -158,7 +158,7 @@ end; { uuid_finalize } -procedure uuid_finalize(var state: uuid_state); +procedure uuid_finalize(out state: uuid_state); begin state := current_state; end; @@ -166,7 +166,7 @@ end; { uuid_create } -function uuid_create(var uuid: uuid_t): boolean; +function uuid_create(out uuid: uuid_t): boolean; var timestamp: uuid_time_t; last_time: uuid_time_t; @@ -202,7 +202,7 @@ end; { uuid_create_md5_from_name } -procedure uuid_create_md5_from_name(var uuid: uuid_t; const nsid: uuid_t; const name: string); +procedure uuid_create_md5_from_name(out uuid: uuid_t; const nsid: uuid_t; const name: string); var net_nsid: uuid_t; c: TMDContext; @@ -227,11 +227,11 @@ end; { uuid_create_sha1_from_name } -procedure uuid_create_sha1_from_name(var uuid: uuid_t; const nsid: uuid_t; const name: string); +procedure uuid_create_sha1_from_name(out uuid: uuid_t; const nsid: uuid_t; const name: string); var net_nsid: uuid_t; -{ c: TMDContext; - hash: TMDDigest;} + c: TSHA1Context; + hash: TSHA1Digest; begin (* put name space ID in network byte order so it hashes the same no matter what endian machine we're on *) @@ -240,10 +240,10 @@ begin net_nsid.time_mid := ntobe(net_nsid.time_mid); net_nsid.time_hi_and_version := ntobe(net_nsid.time_hi_and_version); - {SHAInit(c, SHA_VERSION_1); - SHAUpdate(c, net_nsid, sizeof(net_nsid)); - SHAUpdate(c, pchar(name)^, Length(name)); - SHAFinal(c, hash);} + SHA1Init(c); + SHA1Update(c, net_nsid, sizeof(net_nsid)); + SHA1Update(c, pchar(name)^, Length(name)); + SHA1Final(c, hash); (* the hash is in network byte order at this point *) format_uuid_v3or5(uuid, @hash, UUID_VERSION_5); @@ -266,7 +266,7 @@ end; { read_state } -function read_state(var clockseq: unsigned16; var timestamp: uuid_time_t; var node: uuid_node_t): boolean; +function read_state(out clockseq: unsigned16; out timestamp: uuid_time_t; out node: uuid_node_t): boolean; begin clockseq := current_state.cs; timestamp := current_state.ts; @@ -288,7 +288,7 @@ end; { format_uuid_v1 } -procedure format_uuid_v1(var uuid: uuid_t; const clockseq: unsigned16; const timestamp: uuid_time_t; const node: uuid_node_t); +procedure format_uuid_v1(out uuid: uuid_t; const clockseq: unsigned16; const timestamp: uuid_time_t; const node: uuid_node_t); begin uuid.time_low := timestamp and $FFFFFFFF; uuid.time_mid := (timestamp shr 32) and $FFFF; @@ -303,7 +303,7 @@ end; { format_uuid_v3or5 } -procedure format_uuid_v3or5(var uuid: uuid_t; const hash: pointer; const v: integer); +procedure format_uuid_v3or5(out uuid: uuid_t; const hash: pointer; const v: integer); begin (* convert UUID to local byte order *) move(hash^, uuid, sizeof(uuid)); @@ -325,7 +325,7 @@ var time_last: uuid_time_t; uuids_this_tick: unsigned16 = UUIDS_PER_TICK; -procedure get_current_time(var timestamp: uuid_time_t); +procedure get_current_time(out timestamp: uuid_time_t); var time_now: uuid_time_t; begin @@ -358,7 +358,7 @@ end; { get_system_time } -procedure get_system_time(var timestamp: uuid_time_t); +procedure get_system_time(out timestamp: uuid_time_t); var Epoch:TDateTime; begin |
