Giter Club home page Giter Club logo

spsl's Introduction

SPSL - Special Purpose Strings Library

Travis-CI status AppVeyor status codecov

SPSL is a header-only library for "special" string implementations. It contains the following string class templates:

  • ArrayString/ArrayStringW: Purely stack based string, similar to "plain" C arrays.
  • PasswordString/PasswordStringW: String variant for sensitive data. All memory used by this string implementation is locked in RAM (i.e. it may not be swapped to disk) and is wiped before it's returned to the OS.

If you're interested in the motivation behind these templates, check out the Motivation document. If you're interested in the nitty gritty details of how this library works, head over to Implementation.

Getting started

SPSL is a header-only library, so you don't need to compile anything. Just download it, include it in your project and you're good to go:

#include <spsl.hpp>
spsl::ArrayString<64> a1("I'm a stack-based string and can store 64 characters + NUL");
spsl::ArrayStringW<32> a2(L"Wide characters are ok, too.");
spsl::PasswordString pw1("I'm a secret!");
spsl::PasswordStringW pw2(L"Dream on...");

However, there are a lot of unit tests in this library. If you want to run them (to check compatibility with your platform or if you played with some library code), the next sections are for you.

Dependencies

The SPSL itself only relies on the STL and has no dependencies. To compile the tests, you'll need:

(A copy of the Catch2 test framework is contained.)

Supported compilers (we'll, the ones I've tested) include GCC 4.9+ and clang 4+ on Linux and Microsoft Visual Studio 2015+.

Make sure to clone this repository with:

git clone --recurse-submodules https://github.com/dermojo/spsl.git

Running the tests

SPSL comes with a lot of unit tests. They are compiled into the testlib executable, which can be run standalone or from cmake/ctest.

To build and run all tests, run the usual CMake commands:

mkdir build
cd build
cmake ..
cmake --build .
ctest -VV

License

This project is licensed under the MIT License - see the LICENSE file for details.

tl;dr: Feel free to use and modify the code or to include it in your commercial application.

Acknowledgments

This library uses the MurmurHash3 hash functions, copied thankfully from https://github.com/aappleby/smhasher. Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.