<commit_before>#Sweet HMAC

[![Twitter: @jancassio](https://img.shields.io/badge/contact-@jancassio-blue.svg?style=flat)](https://twitter.com/jancassio)
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/jancassio/SweetHMAC/blob/master/LICENSE)
[![Build](https://api.travis-ci.org/jancassio/SweetHMAC.svg)](https://travis-ci.org/jancassio/SweetHMAC)
![Version](https://cocoapod-badges.herokuapp.com/v/SweetHMAC/badge.png)
![Platforms](https://cocoapod-badges.herokuapp.com/p/SweetHMAC/badge.png)

`SweetHMAC` is a tiny and easy to use Swift class to encrypt strings using HMAC algorithms.
A special thanks to [jernejstrasner](https://gist.github.com/jernejstrasner) for shared [HMACDigest Gist](https://gist.github.com/jernejstrasner/1d5fa5e2fabda2e729d1), that inspired to create this simple class and String extension.

## Usage examples

There are two ways to use Sweet HMAC in your projects

### 1. by String extension
```swift
// Will output this string: e470f785afb708cd8c2a31860642fd11
"I'm going to make him an offer he can't refuse".HMAC(.md5, secret:"Vito Corleone")
```

### 2. by SweetHMAC class

```swift
let quote = "I'm going to make him an offer he can't refuse"
let author = "<NAME>"

// Create a SweetHMAC instance with your message and secret strings
let digest:SweetHMAC = SweetHMAC(message: quote, secret: author)

// Pick some computed HMAC output based on some algorithm using "HMAC" method...
let md5 = digest.HMAC(algorithm: .md5)

// ...or do it more "Sweet" like this
let md5 = SweetHMAC(message: quote, secret: author).HMAC(.MD5)
```

## Supported HMAC algorithms

* MD5
* SHA1
* SHA224
* SHA256
* SHA384
* SHA512

## Installation

SweetHMAC have many clear and simple options to be used in any iOS or OSX projects.

##Using dependency manager
Actually SweetHMAC can be used with those dependency managers
* CocoaPods
* Carthage

###CocoaPods

You can use SweetHMAC with CocoaPods, specify your `Podfile` like this:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'SweetHMAC', '~> 3.0'
```

##Carthage

Also you can use Carthage to SweetHMAC framework at your project, just add SweetHMac in your `Cartfile` file like this:

`github "jancassio/SweetHMAC" >= 3.0`

##Integrated Project

As many iOS/OSX projects, you can add third party libraries in your project as well.
<commit_msg>updated required iOS version number<commit_after>#Sweet HMAC

[![Twitter: @jancassio](https://img.shields.io/badge/contact-@jancassio-blue.svg?style=flat)](https://twitter.com/jancassio)
[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/jancassio/SweetHMAC/blob/master/LICENSE)
[![Build](https://api.travis-ci.org/jancassio/SweetHMAC.svg)](https://travis-ci.org/jancassio/SweetHMAC)
![Version](https://cocoapod-badges.herokuapp.com/v/SweetHMAC/badge.png)
![Platforms](https://cocoapod-badges.herokuapp.com/p/SweetHMAC/badge.png)

`SweetHMAC` is a tiny and easy to use Swift class to encrypt strings using HMAC algorithms.
A special thanks to [jernejstrasner](https://gist.github.com/jernejstrasner) for shared [HMACDigest Gist](https://gist.github.com/jernejstrasner/1d5fa5e2fabda2e729d1), that inspired to create this simple class and String extension.

## Usage examples

There are two ways to use Sweet HMAC in your projects

### 1. by String extension
```swift
// Will output this string: e470f785afb708cd8c2a31860642fd11
"I'm going to make him an offer he can't refuse".HMAC(.md5, secret:"Vito Corleone")
```

### 2. by SweetHMAC class

```swift
let quote = "I'm going to make him an offer he can't refuse"
let author = "<NAME>"

// Create a SweetHMAC instance with your message and secret strings
let digest:SweetHMAC = SweetHMAC(message: quote, secret: author)

// Pick some computed HMAC output based on some algorithm using "HMAC" method...
let md5 = digest.HMAC(algorithm: .md5)

// ...or do it more "Sweet" like this
let md5 = SweetHMAC(message: quote, secret: author).HMAC(.MD5)
```

## Supported HMAC algorithms

* MD5
* SHA1
* SHA224
* SHA256
* SHA384
* SHA512

## Installation

SweetHMAC have many clear and simple options to be used in any iOS or OSX projects.

##Using dependency manager
Actually SweetHMAC can be used with those dependency managers
* CocoaPods
* Carthage

###CocoaPods

You can use SweetHMAC with CocoaPods, specify your `Podfile` like this:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'SweetHMAC', '~> 3.0'
```

##Carthage

Also you can use Carthage to SweetHMAC framework at your project, just add SweetHMac in your `Cartfile` file like this:

`github "jancassio/SweetHMAC" >= 3.0`

##Integrated Project

As many iOS/OSX projects, you can add third party libraries in your project as well.

{'fraction_non_alphanumeric': 0.12422360248447205, 'fraction_numerical': 0.02360248447204969, 'mean_word_length': 4.898656898656899, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '154413', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1648, 'n_words': 496}