An open API service indexing awesome lists of open source software.

https://github.com/yunqing-jia/jmoi_2505c

LaTeX Selective Encryption (Redaction) Package
https://github.com/yunqing-jia/jmoi_2505c

encryption latex-package redaction redaction-and-sensitive-data-protection sensitive-data-security

Last synced: 24 days ago
JSON representation

LaTeX Selective Encryption (Redaction) Package

Awesome Lists containing this project

README

          

# JMOI_2505C | ๐Ÿ›ก๏ธ LaTeX Selective Encryption Package
This README.md was generated with the help of ChatGPT.

A simple, customizable LaTeX package to selectively **"encrypt" sensitive text or hyperlinks** in your documentโ€”using asterisks `*`, hashes `#`, or even filled boxes โ–ฎ โ€” while keeping everything else perfectly readable.

> Want to hide personal data in your PDF before sharing it? Want anonymized previews of confidential content in a paper draft or public submission?

**This package is for you.**

---

## โœจ Features

โœ… Selective encryption of **text** and **hyperlinks**
โœ… Choose your **encryption style**: asterisk `*`, hash `#`, or filled box `โ– `
โœ… Fully **customizable encryption color**
โœ… Encryption level can be **turned off** without modifying your source code

---

## ๐Ÿ“ฆ Files

- `selective-encryption.sty`: The core package file.
- `test.tex`: A sample document showing how to use the package.
- `test.pdf`: Output from `test.tex`, showing encrypted and unencrypted content side-by-side.

---

## ๐Ÿ”ง Installation

Just place `selective-encryption.sty` in the same directory as your `.tex` file, or install it in your local TeX tree.

Then, in your LaTeX document:

```latex
\usepackage[encrypt=2,color=cyan]{selective-encryption}
```

---

## ๐Ÿ” Usage

This package defines two main commands:
- **`\textE{...}`** โ€” Encrypt regular text.
- This command encrypts regular text in the document.
- The content inside the curly braces will be replaced by the encrypted symbol based on the chosen encryption types.
- **Example**:
```latex
\textE{Encrypted text example}
```
- With `encrypt=1`, this would display as `**********`.

- **`\linkE{}{}`** โ€” Encrypt hyperlink display text or URL.
- This command encrypts the hyperlink's display text or the URL itself.
- It works similarly to the `\textE{...}` command but for links.
- **Example**:
```latex
\linkE{https://github.com/}{Github}
```
- With `encrypt=2`, the output will display as `######` in place of the link text, while also masking the URL.

### ๐Ÿ”ข Encryption Types

You can switch encryption types using the encrypt option:

| `encrypt` | Effect | Appearance Example |
|-----------|--------------------------------|--------------------------|
| `0` | No encryption | `@Github` |
| `1` | Encrypted with `*` symbols | `*******` |
| `2` | Encrypted with `#` symbols | `#######` |
| `3` | Encrypted with filled boxes `โ– ` | `โ– โ– โ– โ– โ– โ– โ– ` |

> โ„น๏ธ The number of symbols matches the number of characters in the original string.

### ๐ŸŽจ Color

Use the color option to change the encryption symbol color:

```latex
\usepackage[encrypt=3,color=blue]{selective-encryption}
```
### ๐Ÿงช Example

```latex
\documentclass{article}
%\usepackage[encrypt=0,color=black]{selective-encryption} % default value - no encryption
%\usepackage[encrypt=1,color=cyan]{selective-encryption} % encrypt = 1 : encrypted by *
%\usepackage[encrypt=2,color=cyan]{selective-encryption} % encrypt = 2 : encrypted by #
\usepackage[encrypt=3,color=cyan]{selective-encryption} % encrypt = 3 : encrypted by โ– 

\begin{document}

\section{Latex Selective Encryption Package}

\subsection{No encryption}

\textbf{$@$JMOI\_2505C Project}

\href{https://github.com/}{Github}

\subsection{With encryption}

\textbf{\textE{$@$JMOI\_2505C Project}}

\linkE{https://github.com/}{Github}

\end{document}
```

- Compile this with XeLaTeX to see the difference.

---

## ๐Ÿ“‚ Repository Structure

```
Latex-Selective-Encryption-Package/
โ”‚
โ”œโ”€โ”€ selective-encryption.sty % The encryption package
โ”œโ”€โ”€ test.tex % Usage demo
โ”œโ”€โ”€ test.pdf % Rendered PDF output
โ””โ”€โ”€ README.md % You're reading it!
```

---

## ๐Ÿ“Œ Use Cases

- Publishing reports with redacted content
- Hiding sensitive information in public slides
- Creating versions of a document with different privacy levels

---

## ๐Ÿ“„ License

This package is released under the MIT License. Free to use, modify, and distribute.

---

## โœ๏ธ Author

Created by Yunqing Jia

GitHub: [@Yunqing-Jia](https://github.com/Yunqing-Jia)