1isencrypt(3GEN)    String Pattern-Matching Library Functions   isencrypt(3GEN)
2
3
4

NAME

6       isencrypt - determine whether a buffer of characters is encrypted
7

SYNOPSIS

9       cc  [flag]... [file]... -lgen [library]...
10
11
12       #include<libgen.h>
13
14       int isencrypt(const char *fbuf, size_t ninbuf);
15
16

DESCRIPTION

18       isencrypt() uses heuristics to determine whether a buffer of characters
19       is encrypted. It requires two arguments: a pointer to an array of char‐
20       acters and the number of characters in the buffer.
21
22
23       isencrypt()  assumes  that the file is not encrypted if all the charac‐
24       ters in the first block are ASCII characters. If  there  are  non-ASCII
25       characters  in  the  first  ninbuf  characters,  and if the setlocale()
26       LC_CTYPE category is set to C or ascii, isencrypt()  assumes  that  the
27       buffer is encrypted
28
29
30       If  the LC_CTYPE category is set to a value other than C or ascii, then
31       isencrypt() uses a combination of heuristics to determine if the buffer
32       is  encrypted.  If ninbuf has at least 64 characters, a chi-square test
33       is used to determine if the bytes in the buffer have a uniform  distri‐
34       bution;  if  it does, then isencrypt() assumes the buffer is encrypted.
35       If the buffer has less than 64 characters, a check  is  made  for  null
36       characters  and a terminating  new-line to determine whether the buffer
37       is encrypted.
38

RETURN VALUES

40       If the  buffer  is  encrypted,   1  is  returned;  otherwise,  zero  is
41       returned.
42

ATTRIBUTES

44       See attributes(5) for descriptions of the following attributes:
45
46
47
48
49       ┌─────────────────────────────┬─────────────────────────────┐
50       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
51       ├─────────────────────────────┼─────────────────────────────┤
52       │MT-Level                     │MT-Safe                      │
53       └─────────────────────────────┴─────────────────────────────┘
54

SEE ALSO

56       setlocale(3C), attributes(5)
57

NOTES

59       When  compiling multithreaded applications, the _REENTRANT flag must be
60       defined on the compile line.  This flag should only be used  in  multi‐
61       threaded applications.
62
63
64
65SunOS 5.11                        29 Dec 1996                  isencrypt(3GEN)
Impressum