Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/polinasavelyeva/randomdev
Simple Linux character device — integer generator based on constant-recursive sequences of bytes
https://github.com/polinasavelyeva/randomdev
c linux-module random-generation
Last synced: about 2 months ago
JSON representation
Simple Linux character device — integer generator based on constant-recursive sequences of bytes
- Host: GitHub
- URL: https://github.com/polinasavelyeva/randomdev
- Owner: PolinaSavelyeva
- License: gpl-3.0
- Created: 2024-03-26T21:28:24.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-28T13:23:15.000Z (7 months ago)
- Last Synced: 2024-05-29T04:16:52.167Z (7 months ago)
- Topics: c, linux-module, random-generation
- Language: C
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RandomDev
Simple Linux character device — integer generator based on constant-recursive sequences of bytes
## Simple Usage
To use the RandomDev, follow these steps:
1. Clone the repository:
```
git clone https://github.com/PolinaSavelyeva/RandomDev.git
```2. Navigate to the RandomDev directory:
```
cd RandomDev
```3. Build the library using Make:
```
make
```
4. Insert module and log kernel messages:
```
sudo insmod mymodule.ko
```
```
sudo dmesg
```
or use:
```
make test
```
In kernel log you can see `MAJOR` number for your future character device.5. Assign this `MAJOR` number to a new character device:
```
sudo mknod /dev/randomdev c MAJOR 0
```
6. Make your device file writable and put data into it using `printf`:
```
sudo chmod a+w /dev/randomdev
```
```
printf "\K\A_1\...\A_K\X_1\...\X_K\C" > /dev/randomdev
```
where,
- `K` is an amount of coefficients to be provided in hexadecimal
- `A_i` and `X_i` are hexadecimal coefficients, 1<=i<=K
- `C` is a last polynomial hexadecimal coefficient
example:
`K` = 3,
`A_1` = 5, `A_2` = 2, `A_3` = 1,
`X_1` = 3, `X_2` = 3, `X_3` = 7,
`C` = 4
```
printf "\x03\x05\x02\x01\x03\x03\x07\x04" > /dev/randomdev
```7. Read a sequence of random numbers using `xxd`:
```
xxd /dev/randomdev
```
8. Remove device file:
```
sudo rm /dev/randomdev
```9. Remove module from kernel:
```
sudo rmmod mymodule
```## Build Requirements
- Make utility
- C compilerTested on linux kernel version 5.15.0-107-generic.