OT4XB - HASHTABLE
OT4XB - HASHTABLE
Hi ALL
Anybody with an example code of how to use these OT4XB hashtable functions:
_HDICT_ITERATE_STEP(ht,@pIterator,@item,@key)
_HDICT_ITERATE_STEP(ht, codeblock , @cargo)
Thanks.
Anybody with an example code of how to use these OT4XB hashtable functions:
_HDICT_ITERATE_STEP(ht,@pIterator,@item,@key)
_HDICT_ITERATE_STEP(ht, codeblock , @cargo)
Thanks.
Re: OT4XB - HASHTABLE
Hi
Here is an example
There is a manual, which explains its use, go to the page of xbwin
Best Regard
Héctor
#include "ot4xb.ch"
#define MYLOOP 1000
// ---------------------------------------------------------------------------
function Main()
local nSeconds := Seconds()
local oDict := THDict():New(10000000)
local hh := oDict:_m__pHt_
local n,nn
oDict:Pablo := "Hellou Pablo"
? oDict:Pablo
for n := 1 to MYLOOP
? n
for nn := 1 to 1000
_HDICT_SETPROP(hh, n , cPrintf( "Hellou %u",n) )
next
next
? oDict:GetProp(167)
? oDict:Richard
oDict:Destroy()
? "Seconds:" , Seconds() - nSeconds
inkey(0)
return NIL
// ---------------------------------------------------------------------------
/*
oDict : Pepito := "Hellou Pepito"
oDict : Menganito := { 1,2,3,4,5}
oDict : SetProp( "Joseh" , "Hellou Joseh" )
? oDict : Joseh // Hellou Joseh
? oDict : GetProp( "Joseh" )
*/
//use express++
#define cST aApp[01]
#define cCodCli aApp[02]
#define cPrestamo aApp[03]
#define cPrestamoACambiar aApp[04]
#define cMoneda aApp[05]
#define cMonto aApp[06]
#define cTasa aApp[07]
#define cInteres aApp[08]
//use class THDict
oApp := THDict():New()
oApp:cST
oApp:cCodCli
oApp:cPrestamo
oApp:cPrestamoACambiar
oApp:cMoneda
oApp:cMonto
Here is an example
There is a manual, which explains its use, go to the page of xbwin
Best Regard
Héctor
#include "ot4xb.ch"
#define MYLOOP 1000
// ---------------------------------------------------------------------------
function Main()
local nSeconds := Seconds()
local oDict := THDict():New(10000000)
local hh := oDict:_m__pHt_
local n,nn
oDict:Pablo := "Hellou Pablo"
? oDict:Pablo
for n := 1 to MYLOOP
? n
for nn := 1 to 1000
_HDICT_SETPROP(hh, n , cPrintf( "Hellou %u",n) )
next
next
? oDict:GetProp(167)
? oDict:Richard
oDict:Destroy()
? "Seconds:" , Seconds() - nSeconds
inkey(0)
return NIL
// ---------------------------------------------------------------------------
/*
oDict : Pepito := "Hellou Pepito"
oDict : Menganito := { 1,2,3,4,5}
oDict : SetProp( "Joseh" , "Hellou Joseh" )
? oDict : Joseh // Hellou Joseh
? oDict : GetProp( "Joseh" )
*/
//use express++
#define cST aApp[01]
#define cCodCli aApp[02]
#define cPrestamo aApp[03]
#define cPrestamoACambiar aApp[04]
#define cMoneda aApp[05]
#define cMonto aApp[06]
#define cTasa aApp[07]
#define cInteres aApp[08]
//use class THDict
oApp := THDict():New()
oApp:cST
oApp:cCodCli
oApp:cPrestamo
oApp:cPrestamoACambiar
oApp:cMoneda
oApp:cMonto
Re: OT4XB - HASHTABLE
Hi
manual of ot4xb, see page 76 and tells you how to use this function.
Best Regard
Héctor
manual of ot4xb, see page 76 and tells you how to use this function.
Best Regard
Héctor
- Attachments
-
- ot4xb-manual.rar
- (1.26 MiB) Downloaded 888 times
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: OT4XB - HASHTABLE
What is the General purpose of OT4XB-HASHTABLE? What are the benefits?
Re: OT4XB - HASHTABLE
Hi Eugene
Here in this url https://en.wikipedia.org/wiki/Hash_table
there's a description of what is a hash table
In computing, a hash table (hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values.
A hash table uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.
hash table is used in many languages, java, harbour, csharp, etc.
From the previous answer, download the manual for yourself and examples , and read page 76
Best Regard
Héctor Pezoa
Here in this url https://en.wikipedia.org/wiki/Hash_table
there's a description of what is a hash table
In computing, a hash table (hash map) is a data structure that implements an associative array abstract data type, a structure that can map keys to values.
A hash table uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.
hash table is used in many languages, java, harbour, csharp, etc.
From the previous answer, download the manual for yourself and examples , and read page 76
Best Regard
Héctor Pezoa
- Eugene Lutsenko
- Posts: 1649
- Joined: Sat Feb 04, 2012 2:23 am
- Location: Russia, Southern federal district, city of Krasnodar
- Contact:
Re: OT4XB - HASHTABLE
Thank you very much, Héctor! And can they be used to handle CSV files, roughly like a database (dbf) with an index?
Re: OT4XB - HASHTABLE
hi
when store a Password you store HASH instead of plain Text.
when have a HASH you can compare with other HASH but you can't get Original Value back.
when store a Password you store HASH instead of plain Text.
when have a HASH you can compare with other HASH but you can't get Original Value back.
greetings by OHR
Jimmy
Jimmy
Re: OT4XB - HASHTABLE
Hi Eugene
Attached example using dbf and hash
You can make many combinations, even using xsd file, XML, etc etc etc etc.
Best regard
Héctor
Attached example using dbf and hash
You can make many combinations, even using xsd file, XML, etc etc etc etc.
Best regard
Héctor
- Attachments
-
- hashcont.rar
- (147.99 KiB) Downloaded 872 times
Re: OT4XB - HASHTABLE
Hi Jimmy
We're not talking about the openssl hash.
If you want to use this type of hash, ot4xb, you have
the following function (see manual use of cryptography in xbwin )
*1 = SHA1 2 = SHA256 3 = SHA384 4 = SHA512 (default hash type) - 512 bit Digest
FUNCTION fSha( _chain)
RETURN OT4XB_HASH():SHA256(_chain, 0)
But we're talking about hash table (htdic , expando class)
You do the following
oDict : SetProp( "Joseh" , "Hellou Joseh" )
? oDict : Joseh // Hellou Joseh
? oDict : GetProp( "Joseh" )
In ot4xb, you have hash and its derivative expando
You also have
If you save your name Jimmy, use (index and value )
then you can recover with find Jimmy
INLINE METHOD getNoIVar( k )
return ::get_prop(k)
//---------------------------------------
INLINE METHOD setNoIVar( k, v )
return ::set_prop(k,v)
Best Regard
Héctor
We're not talking about the openssl hash.
If you want to use this type of hash, ot4xb, you have
the following function (see manual use of cryptography in xbwin )
*1 = SHA1 2 = SHA256 3 = SHA384 4 = SHA512 (default hash type) - 512 bit Digest
FUNCTION fSha( _chain)
RETURN OT4XB_HASH():SHA256(_chain, 0)
But we're talking about hash table (htdic , expando class)
You do the following
oDict : SetProp( "Joseh" , "Hellou Joseh" )
? oDict : Joseh // Hellou Joseh
? oDict : GetProp( "Joseh" )
In ot4xb, you have hash and its derivative expando
You also have
If you save your name Jimmy, use (index and value )
then you can recover with find Jimmy
INLINE METHOD getNoIVar( k )
return ::get_prop(k)
//---------------------------------------
INLINE METHOD setNoIVar( k, v )
return ::set_prop(k,v)
Best Regard
Héctor
Re: OT4XB - HASHTABLE
hi Héctor,
it seem like Xbase++ v2.x DataObject
ah ... have not used it yet.patito wrote:We're not talking about the openssl hash.
...
But we're talking about hash table (htdic , expando class)
it seem like Xbase++ v2.x DataObject
greetings by OHR
Jimmy
Jimmy