How to calculate the checksum of the REBOL 3 module?

In REBOL 3, it is possible to calculate the checksum of the SHA1 module. When REBOL loads the module, it compares a checksum with the checksum of the loaded module, and if they do not match, an error occurs, as follows: access error: invalid checksum (tampered file).

No matter how I try, I canโ€™t create a module checksum that I like REBOL 3. When I look at the documentation for import, its clarification /checksays to use checksum/securefor mold/flat. I tried all kinds of options for this without any luck:

import / check% module.r checksum / secure to-binary mold / flat load / all% module.r
import / check% module.r checksum / secure to-binary mold / flat load% module.r
import / check% module.r checksum / secure to-binary mold / only / flat load / all% module.r
import / check% module.r checksum / secure to-binary mold / only / flat load% module.r
import / check% module.r checksum / secure read% module.r

etc. None of this works. There must be some simple thing that I am doing wrong.

+3
source share
1 answer

Here's the answer:

import / check% module.r checksum / secure to-binary mold / flat load / unbound / header% module.r

Of course, usually you pre-compute the checksum and use it as a literal, otherwise it will not bring you much benefit as a security check:

import / check% module.r # {A3CD837D0CF843302221C074E88A64AA0147E07E}
+2
source

Source: https://habr.com/ru/post/1719583/


All Articles