Skip to content

__mcc_source_encrypt__

miscellaneous · scripts/miscellaneous/__mcc_source_encrypt__.m

: out_path = __mcc_source_encrypt__ (src_path)
: out_path = __mcc_source_encrypt__ (src_path, out_path)
: out_path = __mcc_source_encrypt__ (src_path, out_path, key_hex)

Scramble a MATLAB/Nexus .m source file with a 256-bit symmetric key.

This is the Nexus Compiler-style source seal used by mcc -k (not p-code). The ciphertext format is Nexus-private (‘NXMS’). MATLAB Compiler encrypts .m sources inside a CTF with AES-256; Nexus matches the mcc -k command surface and uses the same NEXUS_PFILE_KEY key material as p-files.

The key is a 64-character hex string (32 bytes), resolved in order:

  1. key_hex argument when non-empty
  2. environment variable NEXUS_PFILE_KEY

out_path defaults to src_path with the extension replaced by .nms. Returns the path written.