Article View: net.micro.mac
Article #1299Finder info (FCMT's)
From: Jim Perry
Date: Thu, 02 May 1985 17:27
Date: Thu, 02 May 1985 17:27
32 lines
1958 bytes
1958 bytes
The Finder's information strings containing the text entered in the Get Info
window are stored as FCMT (=STR ) resources in the volume's DeskTop file.
The resource ID is computed from the filename as a 15-bit hash code (always
negative), with no provision for handling collisions. The specific hashing
algorithm is,
result <- 0
for each byte in the name (L->R),
result <- ror.w(result xor byte, 1)
if no carry (result positive), negate result
In Lisa Pascal (post-3.0; if using toolbox bit ops, watch for integer->longint
sign extension),
var result,i: integer; b: boolean; name: str255;
...
result := 0;
for i := 1 to length(name) do begin
result := bxor(result, ord(name[i]));
b := odd(result); (* would rotate produce carry? *)
result := bsr(result,1); (* long rotate doesn't help *)
if b then result := bor(result,$8000) (* simulate carry *)
else result := -result; (* if no carry, negate *)
end;
Perhaps the reason Apple hasn't spread this around more is that it's not
a very good scheme: multiple unrelated names can map into the same FCMT --
most unfriendly. Why not just use named resources? Anyway, anybody using
this information for e.g. file transfer would do well do plan ahead for
incompatible Finder changes.
Jim Perry, Dartmouth College jimp@dartvax
Technical Details
Message-ID:
<3008@dartvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!decvax!dartvax!jimpShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site dartvax.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!dartvax!jimp From: jimp@dartvax.UUCP (Jim Perry) Newsgroups: net.micro.mac Subject: Finder info (FCMT's) Message-ID: <3008@dartvax.UUCP> Date: Thu, 2-May-85 13:27:00 EDT Article-I.D.: dartvax.3008 Posted: Thu May 2 13:27:00 1985 Date-Received: Tue, 7-May-85 20:05:12 EDT Distribution: net Organization: Dartmouth College, Hanover, NH Lines: 32