demo-sodium-c-hello-world

Demo Sodium cryptography library in C source code using a simple "hello world" program

https://github.com/joelparkerhenderson/demo-sodium-c-hello-world

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.1%) to scientific vocabulary
Last synced: 8 months ago · JSON representation ·

Repository

Demo Sodium cryptography library in C source code using a simple "hello world" program

Basic Info
  • Host: GitHub
  • Owner: joelparkerhenderson
  • Language: C
  • Default Branch: master
  • Size: 4.88 KB
Statistics
  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created almost 8 years ago · Last pushed about 1 year ago
Metadata Files
Readme Citation

README.md

Demo Sodium C hello world

Demonstration of:

Get Sodium

Visit https://download.libsodium.org/libsodium/releases/

We prefer getting the latest version.

Download:

sh curl -O https://download.libsodium.org/libsodium/releases/LATEST.tar.gz tar xvzf LATEST.tar.gz cd libsodium-stable

Install:

sh ./configure make && make check sudo make install

Write the demo

Create a file demo.c with this C code:

```c

include

int main(void) { if (sodium_init() < 0) { puts("Sodium library couldn't be initialized, it is not safe to use."); exit(1); } puts("Sodium library is initialized."); exit(0); } ```

Run the demo

Compile:

sh gcc -lsodium demo.c -o demo

Run:

sh ./demo

Output:

sh Sodium library is initialized.

Generate random data

The randombytes_buf() function fills size bytes starting at buf with an unpredictable sequence of bytes.

c unsigned int buf_len = 16; unsigned char buf[buf_len]; randombytes_buf(buf, buf_len);

Format a hexadecimal string

The sodium_bin2hex() function converts a byte array into a hexadecimal string with a nul byte (\0) terminator.

c unsigned int hex_len = buf_len * 2 + 1; char hex[hex_len]; sodium_bin2hex(hex, hex_len, buf, buf_len); puts(hex);

Owner

  • Name: Joel Parker Henderson
  • Login: joelparkerhenderson
  • Kind: user
  • Location: California

Software developer. Technology consultant. Creator of GitAlias.com, NumCommand.com, SixArm.com, and many open source projects.

Citation (CITATION.cff)

cff-version: 1.2.0
title: Demo Sodium C hello world
message: >-
  If you use this work and you want to cite it,
  then you can use the metadata from this file.
type: software
authors:
  - given-names: Joel Parker
    family-names: Henderson
    email: joel@joelparkerhenderson.com
    affiliation: joelparkerhenderson.com
    orcid: 'https://orcid.org/0009-0000-4681-282X'
identifiers:
  - type: url
    value: 'https://github.com/joelparkerhenderson/demo-sodium-c-hello-world/'
    description: Demo Sodium C hello world
repository-code: 'https://github.com/joelparkerhenderson/demo-sodium-c-hello-world/'
abstract: >-
  Demo Sodium C hello world
license: See license file

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 6
  • Total Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Joel Parker Henderson j****l@j****m 6
Committer Domains (Top 20 + Academic)