Skip to content

File wsh_shell_misc.h

FileList > src > wsh_shell_misc.h

Go to the source code of this file

Miscellaneous helper utilities for the shell. More...

  • #include "wsh_shell_cfg.h"
  • #include "wsh_shell_types.h"

Public Functions

Type Name
void WshShellMisc_AsciiPrint (const WshShell_U8_t * pBuff, WshShell_Size_t len)
Print a ASCII dump of a buffer.
WshShell_U32_t WshShellMisc_CalcJenkinsHash (const WshShell_U8_t * pcBuff, WshShell_Size_t len)
Calculate Jenkins one-at-a-time hash.
void WshShellMisc_HexDump (const WshShell_U8_t * pBuff, WshShell_Size_t len, WshShell_Size_t offset)
Print a hex + ASCII dump of a buffer (hexdump -C style).

Detailed Description

This module provides various helper functions that do not belong to specific subsystems, but are commonly used across the shell. Currently includes hashing utilities and may be extended in the future.

Author:

Whoosh Embedded Team

Copyright:

Copyright (c) 2025

Public Functions Documentation

function WshShellMisc_AsciiPrint

Print a ASCII dump of a buffer.

1
2
3
4
void WshShellMisc_AsciiPrint (
    const WshShell_U8_t * pBuff,
    WshShell_Size_t len
) 

Parameters:

  • pBuff Pointer to the data buffer.
  • len Number of bytes to dump.

function WshShellMisc_CalcJenkinsHash

Calculate Jenkins one-at-a-time hash.

1
2
3
4
WshShell_U32_t WshShellMisc_CalcJenkinsHash (
    const WshShell_U8_t * pcBuff,
    WshShell_Size_t len
) 

This function computes the 32-bit Jenkins one-at-a-time hash for the given buffer. It is a simple and fast non-cryptographic (!) hash function, commonly used for hash tables and quick data checksums.

Parameters:

  • pcBuff Pointer to the input buffer.
  • len Number of bytes in the input buffer.

Returns:

32-bit hash value computed over the input buffer.

Note:

This hash is not suitable for cryptographic purposes !!! It is designed for speed and good distribution in hash tables.

Jenkins hash function https://en.wikipedia.org/wiki/Jenkins_hash_function


function WshShellMisc_HexDump

Print a hex + ASCII dump of a buffer (hexdump -C style).

1
2
3
4
5
void WshShellMisc_HexDump (
    const WshShell_U8_t * pBuff,
    WshShell_Size_t len,
    WshShell_Size_t offset
) 

Each row contains the byte offset, up to 16 bytes in hex (split into two groups of 8), and their printable ASCII representation. Non-printable bytes are shown as '.'.

Example output:

00000000  57 73 68 53 68 65 6c 6c  00 01 7e 7f 80 ff       |WshShell..~...|

Parameters:

  • pBuff Pointer to the data buffer. May be NULL only when len == 0.
  • len Number of bytes to dump.
  • offset Base value printed in the offset column (use 0 for relative offsets).


The documentation for this class was generated from the following file src/wsh_shell_misc.h