sec_random_token (public)
sec_random_token
Defined in packages/acs-tcl/tcl/security-procs.tcl
Generates a random token.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # ::tcl_sec_seed is used to maintain a small subset of the previously # generated random token to use as the seed for the next # token. This makes finding a pattern in sec_random_token harder # to guess when it is called multiple times in the same thread. if { [ad_conn -connected_p] } { set request [ad_conn request] set start_clicks [ad_conn start_clicks] } else { set request "yoursponsoredadvertisementhere" set start_clicks "cvs.openacs.org" } if {[acs::icanuse "ns_crypto::randombytes"]} { if {![info exists ::tcl_sec_seed]} { set ::tcl_sec_seed [ns_crypto::randombytes 16].$start_clicks } set random_base [ns_sha1 "[ns_time][ns_crypto::randombytes -encoding binary 16]$start_clicks$request$::tcl_sec_seed"] } else { if {![info exists ::tcl_sec_seed]} { set ::tcl_sec_seed [ns_rand].$start_clicks } set random_base [ns_sha1 "[ns_time][ns_rand]$start_clicks$request$::tcl_sec_seed"] } set ::tcl_sec_seed [string range $random_base 0 10] return [ns_sha1 [string range $random_base 11 39]]Generic XQL file: packages/acs-tcl/tcl/security-procs.xql
PostgreSQL XQL file: packages/acs-tcl/tcl/security-procs-postgresql.xql
Oracle XQL file: packages/acs-tcl/tcl/security-procs-oracle.xql