base32.h revision 2229ffbfe08c2cd606c305f8934e627548002c9e
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews/*
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * The contents of this file are subject to the terms of the Common Development and
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * Distribution License (the License). You may not use this file except in compliance with the
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * License.
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews *
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * specific language governing permission and limitations under the License.
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews *
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * When distributing Covered Software, include this CDDL Header Notice in each file and include
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * Header, with the fields enclosed by brackets [] replaced by your own identifying
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * information: "Portions copyright [year] [name of copyright owner]".
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews *
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * Copyright 2015-2016 ForgeRock AS.
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews *
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * Portions Copyright 2010 Markus Gutschke, Google Inc.
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews */
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews/***********************************************************************
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * Encode and decode Base32 based on the RFC 4648
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * (http://tools.ietf.org/html/rfc4648)
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews *
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * String to be encoded is assumed to be ASCII characters.
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews *
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * Encoded output will consist of the following alphabet:
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews * "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews ***********************************************************************/
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews#ifndef _BASE32_H_
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews#define _BASE32_H_
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews#import <stdint.h>
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrewsint __attribute__((visibility("hidden")))
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrewsbase32_decode(const char *encoded, uint8_t *result, int bufSize);
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrewsint __attribute__((visibility("hidden")))
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrewsbase32_encode(const uint8_t *data, int length, char *result, int bufSize);
91f66e374b1c5b8cecc18dfb7ae869900b22e904Mark Andrews#endif /* _BASE32_H_ */