Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/Semant/pickle/rehash.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/Semant/pickle/rehash.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 879, Thu Jul 19 18:59:38 2001 UTC revision 1058, Fri Feb 8 20:02:56 2002 UTC
# Line 9  Line 9 
9   * of re-hashing will then be the same value that would have been   * of re-hashing will then be the same value that would have been
10   * produced had the smaller environment been pickled (and hashed) in   * produced had the smaller environment been pickled (and hashed) in
11   * the first place. *)   * the first place. *)
12  structure Rehash = struct  structure Rehash : sig
13      fun rehash { env, orig_hash } =      val addPepper : { hash: PersStamps.persstamp, pepper: string }
14          #hash (PickMod.pickleEnv (PickMod.REHASH orig_hash) env)                      -> PersStamps.persstamp
15        val rehash : { env: StaticEnv.staticEnv,
16                       orig_pid: PersStamps.persstamp,
17                       pepper: string }
18                     -> PersStamps.persstamp
19    end = struct
20        fun addPepper { hash, pepper } = let
21            val crc = CRC.fromString (Byte.bytesToString (PersStamps.toBytes hash))
22            fun append (c, x) = CRC.append (x, c)
23            val crc' = CharVector.foldl append crc pepper
24        in
25            PersStamps.fromBytes (Byte.stringToBytes (CRC.toString crc'))
26        end
27    
28        fun rehash { env, orig_pid, pepper } =
29            addPepper { hash = #hash (PickMod.pickleEnv
30                                          (PickMod.REHASH orig_pid)
31                                          env),
32                        pepper = pepper }
33  end  end

Legend:
Removed from v.879  
changed lines
  Added in v.1058

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0