{"id":13657016,"url":"https://github.com/bartobri/libnms","last_synced_at":"2025-04-14T00:25:16.876Z","repository":{"id":18361193,"uuid":"76895678","full_name":"bartobri/libnms","owner":"bartobri","description":"A library for reproducing the famous data decryption effect shown in the 1992 film Sneakers.","archived":false,"fork":false,"pushed_at":"2023-02-17T17:17:47.000Z","size":66,"stargazers_count":69,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T14:47:10.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartobri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"bartobri"}},"created_at":"2016-12-19T20:41:25.000Z","updated_at":"2025-01-23T12:57:10.000Z","dependencies_parsed_at":"2024-01-14T16:11:53.756Z","dependency_job_id":null,"html_url":"https://github.com/bartobri/libnms","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartobri%2Flibnms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartobri%2Flibnms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartobri%2Flibnms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartobri%2Flibnms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartobri","download_url":"https://codeload.github.com/bartobri/libnms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248800104,"owners_count":21163404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:00:35.850Z","updated_at":"2025-04-14T00:25:16.811Z","avatar_url":"https://github.com/bartobri.png","language":"C","readme":"![Version](https://img.shields.io/badge/Version-0.1.0-green.svg)\n\nLike this project? Consider sponsoring me: [https://github.com/sponsors/bartobri](https://github.com/sponsors/bartobri)\n\nLibNMS\n======\n\nThis project provides a dynamically linked library that contains the\nnecessary functionality to recreate the famous data decryption effect\nshown in the 1992 film [Sneakers](https://www.youtube.com/watch?v=F5bAa6gFvLs\u0026t=35).\n\nIt's intended purpose is to be used for any software project whose author\nmay wish to use this effect when presenting data to the user. This library\nalso provides capabilities for getting user input in the case of a menu\nor set of selections is presented to the user. See the [usage](#usage) section\nfor details.\n\nThis library has no dependencies, but it does rely on ANSI/VT100 escape\nsequences to recreate the effect. Most modern terminal programs support\nthese sequences so this should not be an issue for most users. If yours\ndoes not, you may need to use an alternate terminal program like xTerm.\n\nIf you wish to get an idea of how this looks or if it will work on your\nsystem, without needing to implement this library inside a separate program,\nyou can download and install my other project, [no-more-secrets](https://github.com/bartobri/no-more-secrets),\nwhich implements this same code in a command line tool that applies the\neffect to piped data.\n\nScreen Cap:\n\n![Screenshot](https://www.brianbarto.info/static/nms/nms.gif)\n\nTable of Contents\n-----------------\n\n1. [Download and Install](#download-and-install)\n2. [Compiling](#compiling)\n3. [Usage](#usage)\n4. [License](#license)\n\nDownload and Install\n--------------------\n\nIn order to download and build this library, you will need to have `git`,\n`gcc`, and `make` installed. Install them from your package manager if not\nalready installed.\n\n```\n$ which make\n/usr/bin/make\n\n$ which gcc\n/usr/bin/gcc\n\n$ which git\n/usr/bin/git\n```\n\nDownload and Install:\n\n```\n$ git clone https://github.com/bartobri/libnms.git\n$ cd libnms\n$ make\n$ sudo make install\n```\n\nUninstall:\n\n```\n$ sudo make uninstall\n```\n\nCompiling\n---------\n\nYou must tell the compiler to include the nms library.\n\n```\ngcc myprogram.c -lnms\n```\n\nUsage\n-----\n\n**Synopsys**\n```\ninclude \u003cnms.h\u003e\n\nint main(void) {\n\n    // Apply the effect to the string \"setec astronomy\"\n    nms_exec(\"setec astronomy\");\n    \n    // Make the foreground color of the decrypted characters \"red\"\n    nms_set_foreground_color(\"red\");\n    nms_exec(\"setec astronomy\");\n    \n    // Initiate decryption sequence without requiring a key press\n    nms_set_auto_decrypt(1);\n    nms_exec(\"setec astronomy\");\n    \n    // Clear screen prior to displaying any output\n    nms_set_clear_scr(1);\n    nms_exec(\"setec astronomy\");\n    \n    // Do not use color (for terminals that don't support color)\n    nms_use_color(0);\n    nms_exec(\"setec astronomy\");\n    \n    // Require the user to choose 1, 2, or 3 before returning execution to main()\n    nms_set_return_opts(\"123\");\n    char c = nms_exec(\"Choose: [1] apples [2] oranges [3] pears\");\n    printf(\"User chose %c\", c);\n    \n    // Set the cursor position to 0/2 (x/y) when getting user selection\n    nms_set_input_position(0, 2);\n    nms_set_return_opts(\"123\");\n    char c = nms_exec(\"Choose: [1] apples [2] oranges [3] pears\");\n    printf(\"User chose %c\", c);\n    \n    return 0;\n}\n```\n\n**Functions**\n\n`char nms_exec(char *)`\n\nThe nms_exec() is the primary function for this library. It applies the\nmovie effect to a given string of characters. If nms_set_return_opts() is\nused, this function will return the user selection. Otherwise it returns\nzero.\n\nThis is the only function that must be called to generate the movie effect.\nAll other functions are used to taylor its behavior. Read below for more.\n\n`void nms_set_foreground_color(char *)`\n\nThe nms_set_foreground_color() function sets the desired foreground color\nof the decrypted characters displayed by nms_exec(). Valid arguments are\n\"white\", \"yellow\", \"black\", \"magenta\", \"blue\", \"green\", \"red\" and \"cyan\".\nBlue is the default. No value is returned.\n\n`void nms_set_auto_decrypt(int)`\n\nThe nms_set_auto_decrypt() function sets a flag that nms_exec() uses to\ninitiate the decryption sequence without the need for the user to press a\nkey. If the integer argument is evaluated as true, the flag is turned on.\nIf false, it is turned off.\n\n`void nms_set_clear_scr(int)`\n\nThe nms_set_clear_scr() function sets a flag that nms_exec() checks to\ndetermine if it will clear the screen prior to displaying any output. If\nthe integer argument is evaluated as true, the flag is turned on.\nIf false, it is turned off. The flag is off by default. Note that the\nscreen contents prior to clearing are saved and restored once the effect\nhas completed.\n\n`void nms_use_color(int)`\n\nThe nms_use_color() function sets a flag that nms_exec() checks to determine\nif it will use color escape sequences when displaying unencrypted characters.\nIf the integer argument is evaluated as true, the flag is turned on.\nIf false, it is turned off.  The flag is on by default. This function exists\nto support terminals that do not have color capabilities.\n\n`void nms_set_return_opts(char *)`\n\nThe nms_set_return_opts() function sets the character options that nms_exec()\nrequires the user to choose from before it returns execution to the calling\nfunction. This is intended to be used for cases where the string passed\nto nms_exec() contains a menu with a set of selections. Note that nms_exec()\nreturns the selection to the calling function.\n\n`void nms_set_input_position(int, int)`\n\nThe nms_set_input_position() function is meant to be used in conjunction with\nthe nms_set_return_opts() function. It sets the cursor position to the given x/y\ncoordinates when nms_exec() requires a menu selection from the user.\n\nLicense\n-------\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the the\nMIT License (MIT). See [LICENSE](LICENSE) for more details.\n\n","funding_links":["https://github.com/sponsors/bartobri"],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartobri%2Flibnms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartobri%2Flibnms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartobri%2Flibnms/lists"}