Top Related Projects
Quick Overview
ISA-L (Intelligent Storage Acceleration Library) is an open-source collection of optimized low-level functions for storage applications. Developed by Intel, it focuses on performance-critical operations such as erasure coding, data compression, and cryptographic hashing, leveraging Intel's architecture features for maximum efficiency.
Pros
- High-performance implementations of common storage algorithms
- Optimized for Intel architectures, utilizing advanced instruction sets
- Supports a wide range of storage-related operations
- Regularly updated and maintained by Intel
Cons
- Primarily optimized for Intel processors, potentially less efficient on other architectures
- Requires some low-level understanding to integrate effectively
- Documentation could be more comprehensive for beginners
Code Examples
- CRC calculation:
#include <isa-l.h>
uint32_t crc = 0;
uint8_t *data = /* your data */;
size_t len = /* data length */;
crc = crc32_ieee(crc, data, len);
- Compression using IGZIP:
#include <isa-l.h>
struct isal_zstream stream;
uint8_t *in_buf = /* input data */;
size_t in_size = /* input size */;
uint8_t *out_buf = /* output buffer */;
size_t out_size = /* output buffer size */;
isal_deflate_init(&stream);
stream.next_in = in_buf;
stream.avail_in = in_size;
stream.next_out = out_buf;
stream.avail_out = out_size;
isal_deflate(&stream, IGZIP_FINISH);
- Erasure coding:
#include <isa-l.h>
int k = 8, m = 2; // data and parity shards
uint8_t *data[k], *coding[m];
// Initialize data and coding pointers
int nerrs = 2;
int errs[nerrs] = {0, 1}; // indices of erased shards
uint8_t *recov[nerrs];
// Initialize recov pointers
ec_init_tables(k, m, &g_tbls);
ec_encode_data(len, k, m, g_tbls, data, coding);
ec_encode_data_update(len, k, m, g_tbls, data, coding, nerrs, errs, recov);
Getting Started
To use ISA-L in your project:
-
Clone the repository:
git clone https://github.com/intel/isa-l.git
-
Build and install:
cd isa-l ./autogen.sh ./configure make sudo make install
-
Include ISA-L in your C project:
#include <isa-l.h>
-
Compile with ISA-L:
gcc -o your_program your_program.c -lisal
Competitor Comparisons
Extremely Fast Compression algorithm
Pros of lz4
- Extremely fast compression and decompression speeds
- Simple API and easy integration into various projects
- Wide platform support and language bindings
Cons of lz4
- Lower compression ratio compared to more advanced algorithms
- Limited focus on specific compression tasks
Code comparison
lz4:
char* compressed = LZ4_compress_default(src, dst, srcSize, dstCapacity);
int decompressedSize = LZ4_decompress_safe(compressed, decompressed, compressedSize, maxDecompressedSize);
isa-l:
struct isal_zstream stream;
isal_deflate_init(&stream);
isal_deflate(&stream);
isal_inflate_init(&stream);
isal_inflate(&stream);
Key differences
- lz4 focuses primarily on fast compression/decompression
- isa-l provides a broader set of optimized storage and networking algorithms
- isa-l is specifically optimized for Intel architectures
- lz4 offers a simpler API for basic compression tasks
- isa-l includes additional features like erasure coding and cryptographic operations
Use cases
- lz4: Real-time compression, gaming, data transfer optimization
- isa-l: Storage systems, networking applications, data centers with Intel hardware
Community and support
- lz4: Active community, frequent updates, widely adopted
- isa-l: Backed by Intel, regular updates, focused on enterprise use cases
Zstandard - Fast real-time compression algorithm
Pros of zstd
- Higher compression ratios and faster decompression speeds
- More versatile, supporting a wide range of compression levels
- Active development with frequent updates and improvements
Cons of zstd
- Slower compression speed for higher compression levels
- Larger memory footprint during compression
Code Comparison
zstd:
size_t ZSTD_compress(void* dst, size_t dstCapacity,
const void* src, size_t srcSize,
int compressionLevel);
ISA-L:
int isal_deflate(struct isal_zstream *stream);
Key Differences
- zstd offers a simpler API for basic compression tasks
- ISA-L focuses on hardware-accelerated implementations for Intel architectures
- zstd provides a single function for compression, while ISA-L uses a streaming interface
Use Cases
- zstd: General-purpose compression, especially when high compression ratios are needed
- ISA-L: Performance-critical applications on Intel hardware, particularly for storage and networking
Community and Support
- zstd has a larger community and more widespread adoption
- ISA-L is maintained by Intel and has specialized support for their hardware
A fast compressor/decompressor
Pros of Snappy
- Simpler API and easier integration for general-purpose compression
- Better cross-platform compatibility, not limited to Intel architectures
- More widespread adoption and community support
Cons of Snappy
- Generally slower compression and decompression speeds compared to ISA-L
- Less optimized for specific use cases like storage and networking
- Limited compression ratio compared to ISA-L's more advanced algorithms
Code Comparison
ISA-L (focusing on erasure coding):
erasure_code_base(unsigned char *data, unsigned char **coding,
unsigned int len, unsigned int k, unsigned int rows)
Snappy:
size_t Compress(const char* input, size_t input_length,
std::string* compressed);
ISA-L provides low-level functions for various operations, including erasure coding, while Snappy offers a simpler API focused on general-purpose compression. ISA-L's code is more complex and requires deeper understanding of the underlying algorithms, whereas Snappy's API is more straightforward and easier to use for basic compression tasks.
Both libraries serve different purposes: ISA-L is a comprehensive library for storage and networking optimizations, while Snappy focuses on fast compression with a good balance between speed and compression ratio for general use cases.
A parallel implementation of gzip for modern multi-processor, multi-core machines.
Pros of pigz
- Specialized for parallel gzip compression, offering high-speed performance
- Portable and works on various platforms without specific hardware requirements
- Simple to use with a command-line interface similar to gzip
Cons of pigz
- Limited to gzip compression, unlike ISA-L's broader compression support
- May not fully utilize hardware-specific optimizations available in ISA-L
- Potentially lower compression ratios compared to ISA-L's advanced algorithms
Code Comparison
ISA-L (focusing on compression):
void isal_deflate(struct isal_zstream *stream)
{
struct isal_zstate *state = &stream->internal_state;
struct level_buf *level_buf = stream->level_buf;
...
}
pigz (main compression function):
local void parallel_compress(void)
{
unsigned char *raw, *next, *dict;
...
do {
...
} while (more);
}
Both libraries implement compression algorithms, but ISA-L provides a more generalized approach with support for various compression methods, while pigz focuses specifically on parallel gzip compression. ISA-L's code structure suggests a more modular design, potentially allowing for easier integration into other projects. pigz's code is more straightforward, reflecting its specialized purpose.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Intel(R) Intelligent Storage Acceleration Library
ISA-L is a collection of optimized low-level functions targeting storage applications. ISA-L includes:
- Erasure codes - Fast block Reed-Solomon type erasure codes for any encode/decode matrix in GF(2^8).
- CRC - Fast implementations of cyclic redundancy check. Six different
polynomials supported.
- iscsi32, ieee32, t10dif, ecma64, iso64, jones64, rocksoft64.
- Raid - calculate and operate on XOR and P+Q parity found in common RAID implementations.
- Compression - Fast deflate-compatible data compression.
- De-compression - Fast inflate-compatible data compression.
- igzip - A command line application like gzip, accelerated with ISA-L.
Also see:
- ISA-L for updates.
- For crypto functions see isa-l_crypto on github.
- The github wiki including a list of distros/ports offering binary packages as well as a list of language bindings.
- Contributing.
- Security Policy.
- Docs on units, tests, or build details.
Building ISA-L
Prerequisites
- Make: GNU 'make' or 'nmake' (Windows).
- Optional: Building with autotools requires autoconf/automake/libtool packages.
- Optional: Manual generation requires help2man package.
x86_64:
- Assembler: nasm. 2.14.01 minimum version required support).
- Compiler: gcc, clang, icc or VC compiler.
aarch64:
- Assembler: gas v2.24 or later.
- Compiler: gcc v4.7 or later.
other:
- Compiler: Portable base functions are available that build with most C compilers.
Autotools
To build and install the library with autotools it is usually sufficient to run:
./autogen.sh
./configure
make
sudo make install
Makefile
To use a standard makefile run:
make -f Makefile.unx
Windows
On Windows use nmake to build dll and static lib:
nmake -f Makefile.nmake
or see details on setting up environment here.
Other make targets
Other targets include:
make check
: create and run testsmake tests
: create additional unit testsmake perfs
: create included performance testsmake ex
: build examplesmake other
: build other utilities such as compression file testsmake doc
: build API manual
DLL Injection Attack
Problem
The Windows OS has an insecure predefined search order and set of defaults when trying to locate a resource. If the resource location is not specified by the software, an attacker need only place a malicious version in one of the locations Windows will search, and it will be loaded instead. Although this weakness can occur with any resource, it is especially common with DLL files.
Solutions
Applications using libisal DLL library may need to apply one of the solutions to prevent from DLL injection attack.
Two solutions are available:
- Using a Fully Qualified Path is the most secure way to load a DLL
- Signature verification of the DLL
Resources and Solution Details
- Security remarks section of LoadLibraryEx documentation by Microsoft: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa#security-remarks
- Microsoft Dynamic Link Library Security article: https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-security
- Hijack Execution Flow: DLL Search Order Hijacking: https://attack.mitre.org/techniques/T1574/001
- Hijack Execution Flow: DLL Side-Loading: https://attack.mitre.org/techniques/T1574/002
Top Related Projects
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot