https://github.com/bitbeans/helper-net
A small collection of useful helper methods
https://github.com/bitbeans/helper-net
Last synced: 11 months ago
JSON representation
A small collection of useful helper methods
- Host: GitHub
- URL: https://github.com/bitbeans/helper-net
- Owner: bitbeans
- License: mit
- Created: 2015-08-22T12:50:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-06T19:45:40.000Z (about 8 years ago)
- Last Synced: 2025-04-12T17:51:16.079Z (11 months ago)
- Language: C#
- Size: 21.5 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# helper-net [](https://ci.appveyor.com/project/bitbeans/helper-net) [](https://travis-ci.org/bitbeans/helper-net) [](https://www.nuget.org/packages/helper-net/) [](https://github.com/bitbeans/helper-net/blob/master/LICENSE.md)
A small collection of useful helper methods that I use in several projects.
# Status #
**Pull requests and/or optimization proposals are always welcome!**
# Scope #
## ArrayHelper ##
```csharp
static T[] ConcatArrays(params T[][] arrays)
```
```csharp
static T[] ConcatArrays(T[] arr1, T[] arr2)
```
```csharp
static T[] SubArray(T[] arr, int start, int length)
```
```csharp
static T[] SubArray(T[] arr, int start)
```
```csharp
static bool ConstantTimeEquals(byte[] a, byte[] b)
```
## ConvensionHelper ##
```csharp
static byte[] IntegerToLittleEndian(int data)
```
## CryptoHelper ##
```csharp
static byte[] Xor(byte[] data, IReadOnlyList keys)
```
## StreamHelper ##
```csharp
static byte[] ReadFully(Stream input)
```
## ShellHelper ##
```csharp
static string Escape(string argument, bool quote = false)
```
```csharp
static string ExecuteShellCommand(string filename, string arguments, int timeout = 9000)
```
## PaddingHelper ##
```csharp
static byte[] AddPkcs7(byte[] data, int paddingLength)
```
```csharp
static byte[] RemovePkcs7(byte[] paddedByteArray)
```
```csharp
static byte[] AddZero(byte[] data, int paddingLength)
```
```csharp
static byte[] RemoveZero(byte[] paddedByteArray)
```
## RandomHelper ##
### SecureRandomProvider ###
```csharp
static int Next()
```
```csharp
static int Next(int maxValue)
```
```csharp
static int Next(int minValue, int maxValue)
```
```csharp
static void GetBytes(byte[] data)
```
```csharp
static void GetNonZeroBytes(byte[] data)
```
### RandomProvider ###
```csharp
static int Next()
```
```csharp
static int Next(int maxValue)
```
```csharp
static int Next(int minValue, int maxValue)
```
```csharp
static void GetBytes(byte[] data)
```
### Well512RandomProvider ###
```csharp
static int Next()
```
```csharp
static int Next(int maxValue)
```
```csharp
static int Next(int minValue, int maxValue)
```
## License
[MIT](https://en.wikipedia.org/wiki/MIT_License)