Skip to content

Commit

Permalink
Fix build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cfstras committed Jan 29, 2014
1 parent 2aea82f commit ef52848
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions crypt_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

/*
#cgo LDFLAGS: -lCrypt32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <Wincrypt.h>
Expand All @@ -29,20 +28,19 @@ char* decrypt(byte* in, int len, int *outLen) {
void doFree(char* ptr) {
free(ptr);
}
*/
import "C"

type WindowsCrypt struct {
}

func NewCrypt() crypt {
return &DarwinCrypt{}
return &WindowsCrypt{}
}

func (c *WindowsCrypt) decrypt(input []byte) string {
var pwLen C.int
pwDecC := C.decrypt((*C.byte)(&password[0]), C.int(len(password)), &pwLen)
passwordString := C.GoStringN(pwDecC, pwLen)
return passwordString
var length C.int
decruptedC := C.decrypt((*C.byte)(&input[0]), C.int(len(input)), &length)
decrypted := C.GoStringN(decruptedC, length)
return decrypted
}

0 comments on commit ef52848

Please sign in to comment.