From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1e67a7db835cf5a8,start X-Google-Attributes: gid103376,public From: nahaj@u.cc.utah.edu (John Halleck) Subject: Binary files vs Portablity vs Ada Date: 1999/11/04 Message-ID: <7vt67r$qv0$1@coward.ks.cc.utah.edu>#1/1 X-Deja-AN: 544600513 X-Complaints-To: abuse@cc.utah.edu X-Trace: coward.ks.cc.utah.edu 941759547 27616 155.99.2.7 (4 Nov 1999 23:52:27 GMT) Organization: University of Utah - ACLIS NNTP-Posting-Date: 4 Nov 1999 23:52:27 GMT Newsgroups: comp.lang.ada Date: 1999-11-04T23:52:27+00:00 List-Id: Background: At one time I wrote a version of the Standard Hash Algorithm (SHA, it went with the old government Digital Signature Standard) which I wrote in C... Lately, because GNAT is now around, I've hauled it out again, and redid it in Ada. I then used it as an example for a coworker as to how you can be portable in Ada. The actual algorithm is defined for a bit stream, although almost everyone implements it for bits in byte size chunks. (As I did) Because of this, any file should be Hashable, even on machines with perverse word and byte sizes. Question: Is there even a portable way to get the "raw" bits for a file that works on all machines supporting Ada? (So that it can be handed to a bit oriented version of SHA.) It is not hard to do something that just grabs bytes from a file until done, but that assumes the file is some multiple of eight bits long, and that all data for the file is in the bytes returned. On machines like the Sperry 1100 series, the native word size is 36 bits (Usually chopped into four nine-bit bytes for Text use) And the file is "control word -> image" instead of "embeded control." Can this be done portabily? (I suspect not, but I'm not an Ada expert.) I have something that seems to work for PC's, Mac's, and Unix boxes, but it bugs me that I don't know how to do it in any general way.