[ create a new paste ] login | about

Project: programmingpraxis
Link: http://programmingpraxis.codepad.org/N8fi45eN    [ raw code | output | fork ]

programmingpraxis - Scheme, pasted on Feb 23:
(define (last-pair xs)
  (if (null? (cdr xs)) xs
    (last-pair (cdr xs))))

(define (sort lt? xs)
  (define (merge x1 x2)
    (cond ((null? x1) x2)
          ((null? x2) x1)
          ((lt? (car x2) (car x1))
            (cons (car x2) (merge x1 (cdr x2))))
          (else (cons (car x1)
                      (merge (cdr x1) x2)))))
  (define (merge-pairs xs k)
    (if (or (null? (cdr xs)) (odd? k)) xs
        (merge-pairs
          (cons (merge (car xs) (cadr xs))
                (cddr xs))
          (quotient k 2))))
  (define (next-run run xs)
    (if (or (null? xs)
            (lt? (car xs) (car run)))
        (values (reverse run) xs)
        (next-run (cons (car xs) run)
                  (cdr xs))))
  (define (sorting xs ys k)
    (if (null? xs)
        (car (merge-pairs ys 0))
        (call-with-values
          (lambda ()
            (next-run (list (car xs))
                      (cdr xs)))
          (lambda (run tail)
            (sorting
               tail
               (merge-pairs
                 (cons run ys)
                 (+ k 1))
               (+ k 1))))))
  (if (null? xs) xs (sorting xs '() 0)))

(define cipher-text
  (list->string (map integer->char
    '(14 11 78 17 27 12 83 37 0 9 12 29 7 26 41 2 66 69 4 1 22 41
      69 41 10 23 73 16 53 0 15 17 22 13 83 51 13 11 69 27 12 18
      49 0 0 22 83 8 29 35 69 26 13 22 73 22 38 23 26 13 95 73 7
      47 0 78 0 18 27 7 47 69 25 4 0 73 18 103 3 1 23 30 5 22 52
      22 78 18 18 26 7 34 9 15 11 23 69 83 38 11 10 69 23 8 1 44
      11 11 22 0 73 16 40 19 11 23 22 13 83 51 13 11 69 18 11 10
      52 22 66 69 4 1 26 43 0 78 4 83 4 26 32 13 26 28 83 30 26 41
      1 78 22 4 12 3 51 69 1 19 22 27 83 51 13 11 69 4 8 7 34 23
      29 75 83 73 39 47 0 0 69 52 6 23 103 22 15 12 23 69 83 96 41
      11 17 83 29 27 34 23 11 69 17 12 83 43 12 9 13 7 69 84 103 4
      0 1 83 29 27 34 23 11 69 4 8 0 103 9 7 2 27 29 93 103 69 41
      10 23 73 0 38 18 78 13 28 30 83 32 10 1 1 83 29 27 34 69 2
      12 20 1 7 103 18 15 22 93 73 83 0 10 10 69 7 1 22 41 69 29 0
      3 8 1 38 17 11 1 83 29 27 34 69 2 12 20 1 7 103 3 28 10 30
      73 7 47 0 78 1 18 27 24 41 0 29 22 93 73 83 0 10 10 69 16 8
      31 43 0 10 69 7 1 22 103 9 7 2 27 29 83 96 1 15 28 95 78 83
      38 11 10 69 7 1 22 103 1 15 23 24 7 22 52 22 78 13 22 73 16
      38 9 2 0 23 73 84 41 12 9 13 7 71 84 103 69 58 13 6 26 83 34
      19 11 11 26 7 20 103 6 15 8 22 69 83 38 11 10 69 30 6 1 41 12
      0 2 83 15 28 43 9 1 18 22 13 83 106 72 78 17 27 12 83 33 12
      28 22 7 73 23 38 28 64 111 121 61 27 34 11 78 34 28 13 83 52
      4 7 1 95 73 84 11 0 26 69 7 1 22 53 0 78 7 22 73 18 103 1 1 8
      22 73 26 41 69 26 13 22 73 30 46 1 10 9 22 73 28 33 69 26 13
      22 73 4 38 17 11 23 0 69 83 51 10 78 22 22 25 18 53 4 26 0 83
      6 29 34 69 12 10 23 16 83 40 3 78 18 18 29 22 53 69 8 23 28 4
      83 51 13 11 69 28 29 27 34 23 64 66 83 73 50 41 1 78 22 28 73
      26 51 69 6 4 3 25 22 41 0 10 95 83 73 52 40 1 78 8 18 13 22
      103 17 6 0 83 13 28 42 0 66 69 18 7 23 103 12 26 69 0 12 3 38
      23 15 17 22 13 83 51 13 11 69 4 8 7 34 23 78 4 17 6 5 34 69
      26 13 22 73 23 40 8 11 69 21 27 28 42 69 26 13 22 73 4 38 17
      11 23 83 11 22 43 10 25 69 26 29 93 103 69 41 10 23 73 16 38
      9 2 0 23 73 7 47 0 78 1 28 4 22 103 66 26 13 22 73 0 44 28 64
      66 83 73 54 49 0 0 12 29 14 83 36 4 3 0 95 73 18 41 1 78 8 28
      27 29 46 11 9 69 21 6 31 43 10 25 0 23 73 94 106 69 26 13 22
      73 0 34 6 1 11 23 73 23 38 28 64 111 121 61 27 34 11 78 34 28
      13 83 52 4 7 1 95 73 84 11 0 26 69 7 1 22 103 18 15 17 22 27
      83 50 11 10 0 1 73 7 47 0 78 22 24 16 83 37 0 78 2 18 29 27
      34 23 11 1 83 0 29 51 10 78 4 83 26 26 41 2 2 0 83 11 18 52
      12 0 73 83 26 28 103 17 6 4 7 73 7 47 0 78 1 1 16 83 43 4 0 1
      83 4 18 62 69 15 21 3 12 18 53 75 73 69 83 40 29 35 69 29 10
      83 0 7 103 13 15 21 3 12 29 34 1 84 69 7 1 22 103 18 15 17 22
      27 83 50 11 10 0 1 73 7 47 0 78 22 24 16 83 48 4 29 69 20 8 7
      47 0 28 0 23 73 26 41 17 1 69 26 29 0 103 7 15 22 26 7 95 103
      4 0 1 83 29 27 34 69 10 23 10 73 31 38 11 10 69 18 25 3 34 4
      28 0 23 71 83 103 34 1 1 83 10 18 43 9 11 1 83 29 27 34 69 10
      23 10 73 31 38 11 10 69 84 29 27 34 69 11 4 1 29 27 107 66 78
      4 29 13 83 51 13 11 69 17 8 0 46 11 78 10 21 73 7 47 0 78 18
      18 29 22 53 69 6 0 83 10 18 43 9 11 1 83 78 7 47 0 78 22 22 8
      93 96 69 78 34 28 13 83 52 4 25 69 27 6 4 103 2 1 10 23 73 26
      51 69 25 4 0 71 83 103 49 6 0 29 73 52 40 1 78 22 18 0 23 107
      69 73 41 22 29 83 51 13 11 69 22 8 1 51 13 78 7 1 0 29 32 69
      8 10 1 29 27 103 19 11 2 22 29 18 51 12 1 11 73 73 22 49 0 28
      28 83 2 26 41 1 78 10 21 73 3 43 4 0 17 83 29 27 38 17 78 7
      22 8 1 52 69 29 0 22 13 83 38 11 10 69 22 31 22 53 28 78 14
      26 7 23 103 10 8 69 21 27 6 46 17 78 17 1 12 22 103 10 0 69
      22 8 1 51 13 78 17 27 8 7 103 7 11 4 1 26 83 33 23 27 12 7 73
      4 46 17 6 69 26 29 0 103 22 11 0 23 73 26 41 69 7 17 93 78 83
      103 36 0 1 83 26 28 103 12 26 69 27 8 3 55 0 0 0 23 83 83 103
      17 6 0 83 12 18 53 17 6 69 17 27 28 50 2 6 17 83 15 28 53 17
      6 69 22 31 22 53 28 78 14 26 7 23 103 10 8 69 3 5 18 41 17 78
      17 27 8 7 103 7 11 4 1 26 83 52 0 11 1 83 8 29 35 69 11 19 22
      27 10 103 14 7 11 23 73 28 33 69 8 23 6 0 7 103 17 28 0 22 73
      28 41 69 11 4 1 29 27 103 17 6 4 7 73 17 34 4 28 22 83 15 1
      50 12 26 69 4 0 7 47 69 7 17 0 73 0 34 0 10 69 26 7 83 46 17
      64 69 83 46 28 35 69 29 4 4 73 27 40 18 78 2 28 6 23 103 12
      26 69 4 8 0 105 69 78 32 5 12 29 46 11 9 69 16 8 30 34 73 78
      4 29 13 83 42 10 28 11 26 7 20 103 3 1 9 31 6 4 34 1 78 72 94
      73 7 47 0 78 17 27 0 1 35 69 10 4 10 71 121 77 49 6 0 29 73
      52 40 1 78 22 18 0 23 125 69 73 41 22 29 83 51 13 11 23 22 73
      17 34 69 2 12 20 1 7 52 69 7 11 83 29 27 34 69 10 10 30 12 83
      40 3 78 17 27 12 83 52 14 23 73 83 29 28 103 22 11 21 18 27
      18 51 0 78 1 18 16 83 33 23 1 8 83 7 26 32 13 26 75 83 73 63
      34 17 78 17 27 12 30 103 8 15 23 24 73 7 47 0 78 3 26 17 22
      35 69 26 12 30 12 0 107 69 26 13 22 73 23 38 28 29 69 18 7 23
      103 17 6 0 83 16 22 38 23 29 73 83 8 29 35 69 29 0 1 31 22
      103 4 29 69 31 28 30 46 11 15 23 26 12 0 103 12 0 69 7 1 22
      103 1 1 8 22 73 28 33 69 26 13 22 73 0 44 28 66 69 7 6 83 52
      13 11 1 83 5 26 32 13 26 69 6 25 28 41 69 26 13 22 73 22 38
      23 26 13 93 78 83 103 36 0 1 83 26 28 103 12 26 69 27 8 3 55
      0 0 0 23 83 83 103 34 1 1 83 4 18 35 0 78 17 27 12 83 51 18
      1 69 20 27 22 38 17 78 9 26 14 27 51 22 66 69 7 1 22 103 2
      28 0 18 29 22 53 69 1 11 22 73 7 40 69 9 10 5 12 1 41 69 26
      13 22 73 23 38 28 66 69 18 7 23 103 17 6 0 83 5 22 52 22 11
      23 83 6 29 34 69 26 10 83 14 28 49 0 28 11 83 29 27 34 69 0
      12 20 1 7 124 69 15 11 23 73 27 34 69 3 4 23 12 83 51 13 11
      69 0 29 18 53 22 64 69 83 46 28 35 69 29 0 7 73 7 47 0 3 69
      26 7 83 51 13 11 69 23 6 30 34 69 1 3 83 29 27 34 69 29 14 10
      69 83 51 10 78 22 27 12 23 103 9 7 2 27 29 83 50 21 1 11 83
      29 27 34 69 11 4 1 29 27 107 69 26 10 83 14 28 49 0 28 11 83
      29 27 34 69 10 4 10 73 18 41 1 78 17 27 12 83 41 12 9 13 7 69
      83 38 11 10 69 7 6 83 52 0 30 4 1 8 7 34 69 26 13 22 73 31 46
      2 6 17 83 15 1 40 8 78 17 27 12 83 35 4 28 14 29 12 0 52 75
      78 69 52 6 23 103 22 15 18 83 1 28 48 69 9 10 28 13 83 46 17
      78 18 18 26 93 103 69 43 19 22 7 26 41 2 78 6 18 4 22 107 69
      15 11 23 73 30 40 23 0 12 29 14 83 33 10 2 9 28 30 22 35 69
      67 72 83 29 27 34 69 8 10 6 27 7 47 69 10 4 10 71 121 77 49
      6 0 29 73 52 40 1 78 22 18 0 23 107 69 73 41 22 29 83 51 13
      11 69 4 8 7 34 23 78 17 22 12 30 103 18 7 17 27 73 18 41 69
      15 7 6 7 23 38 11 13 0 83 6 21 103 9 7 19 26 7 20 103 6 28 0
      18 29 6 53 0 29 73 83 8 29 35 69 1 11 83 29 27 34 69 11 4 1
      29 27 103 9 11 17 83 11 26 53 1 29 69 21 5 10 103 7 11 11 22
      8 7 47 69 26 13 22 73 23 40 8 11 69 28 15 83 51 13 11 69 0 2
      10 105 66 78 69 50 7 23 103 22 1 69 26 29 83 47 4 30 21 22 7
      22 35 95 78 69 52 6 23 103 6 28 0 18 29 22 35 69 26 13 22 73
      20 53 0 15 17 83 26 22 38 69 3 10 29 26 7 34 23 29 69 18 7 23
      103 4 2 9 83 2 26 41 1 29 69 28 15 83 52 18 7 8 30 0 29 32 69
      13 23 22 8 7 50 23 11 22 83 30 26 51 13 78 18 27 0 16 47 69
      26 13 22 73 4 38 17 11 23 83 29 22 34 8 29 73 83 8 29 35 69
      15 9 31 73 24 46 11 10 22 83 6 21 103 18 7 11 20 12 23 103 7
      7 23 23 26 93 103 69 41 10 23 73 0 38 18 78 13 28 30 83 32 10
      1 1 83 0 7 103 18 15 22 95 73 18 41 1 78 34 28 13 83 37 9 11
      22 0 12 23 103 17 6 0 30 69 83 52 4 23 12 29 14 95 103 66 44
      0 83 15 22 53 17 7 9 22 69 83 42 16 2 17 26 25 31 62 73 78 4
      29 13 83 33 12 2 9 83 29 27 34 69 25 4 7 12 1 103 10 8 69 7 1
      22 103 22 11 4 0 82 83 38 11 10 69 31 12 7 103 17 6 0 83 11
      26 53 1 29 69 30 28 31 51 12 30 9 10 73 28 41 69 26 13 22 73
      22 38 23 26 13 93 78 83 103 32 24 0 29 0 29 32 69 13 4 30 12
      95 103 4 0 1 83 4 28 53 11 7 11 20 73 21 40 9 2 10 4 12 23
      103 72 67 69 7 1 22 103 3 7 3 7 1 83 35 4 23 75 121 99 39 47
      0 0 69 52 6 23 103 22 15 12 23 69 83 96 41 11 17 83 29 27 34
      69 11 4 1 29 27 103 7 28 12 29 14 83 33 10 28 17 27 73 18 43
      9 78 14 26 7 23 52 69 1 3 83 5 26 49 12 0 2 83 10 1 34 4 26
      16 1 12 0 125 69 13 4 7 29 31 34 73 78 6 1 12 22 55 12 0 2 83
      29 27 46 11 9 22 95 73 18 41 1 78 18 26 5 23 103 4 0 12 30 8
      31 52 69 1 3 83 8 31 43 69 5 12 29 13 0 105 66 78 69 50 7 23
      103 22 1 69 26 29 83 47 4 30 21 22 7 22 35 95 78 69 52 6 23
      103 8 15 1 22 73 18 43 9 78 14 26 7 23 52 69 1 3 83 30 26 43
      1 78 4 29 0 30 38 9 29 73 83 8 31 43 69 5 12 29 13 0 103 10 8
      69 16 8 7 51 9 11 73 83 8 29 35 69 15 9 31 73 24 46 11 10 22
      83 6 21 103 6 28 0 22 25 26 41 2 78 17 27 0 29 32 22 78 10 21
      73 7 47 0 78 0 18 27 7 47 75 78 69 52 6 23 103 22 15 18 83 1
      28 48 69 9 10 28 13 83 46 17 78 18 18 26 93 103 69 58 13 22 7
      83 0 10 10 69 0 8 26 35 95 78 66 63 12 7 103 16 29 69 30 8 24
      34 69 3 4 29 73 26 41 69 1 16 1 73 26 42 4 9 0 95 73 18 33 17
      11 23 83 6 6 53 69 2 12 24 12 29 34 22 29 75 83 73 63 34 17
      78 17 27 12 30 103 13 15 19 22 73 23 40 8 7 11 26 6 29 103 10
      24 0 1 73 7 47 0 78 3 26 26 27 103 10 8 69 7 1 22 103 22 11 4
      95 73 7 47 0 78 7 26 27 23 52 69 1 3 83 29 27 34 69 15 12 1
      69 83 38 11 10 69 7 1 22 103 6 15 17 7 5 22 107 69 15 11 23
      73 28 49 0 28 69 18 5 31 103 17 6 0 83 30 26 43 1 78 4 29 0
      30 38 9 29 69 18 7 23 103 4 2 9 83 29 27 34 69 13 23 22 8 7
      50 23 11 22 83 29 27 38 17 78 6 1 8 4 43 69 1 11 83 29 27 34
      69 9 23 28 28 29 35 75 73 69 83 46 28 35 69 13 23 22 8 7 34 1
      78 8 18 7 83 46 11 78 13 26 26 83 46 8 15 2 22 82 83 46 11 78
      17 27 12 83 35 12 24 12 29 12 83 46 8 15 2 22 73 27 34 69 13
      23 22 8 7 34 1 78 13 26 4 72 103 8 15 9 22 73 18 41 1 78 3 22
      4 18 43 0 78 13 22 73 16 53 0 15 17 22 13 83 51 13 11 8 93 73
      83 0 10 10 69 17 5 22 52 22 11 1 83 29 27 34 8 66 69 0 8 10
      46 11 9 95 83 78 49 34 69 8 0 1 29 26 43 0 78 4 29 13 83 42
      16 2 17 26 25 31 62 94 78 3 26 5 31 103 17 6 0 83 12 18 53 17
      6 69 18 7 23 103 22 27 7 23 28 22 103 12 26 75 83 73 59 38 19
      11 69 23 6 30 46 11 7 10 29 73 28 49 0 28 69 7 1 22 103 3 7
      22 27 73 28 33 69 26 13 22 73 0 34 4 66 69 7 1 22 103 7 7 23
      23 26 83 40 3 78 17 27 12 83 38 12 28 73 83 8 29 35 69 15 9
      31 73 7 47 0 78 9 26 31 26 41 2 78 17 27 0 29 32 22 78 17 27
      8 7 103 8 1 19 22 73 28 41 69 26 13 22 73 22 38 23 26 13 93
      78 83 103 34 1 1 83 8 31 52 10 78 22 18 0 23 125 69 73 54 22
      12 95 103 44 78 2 26 31 22 103 28 1 16 83 12 5 34 23 23 69 0
      12 22 35 72 12 0 18 27 26 41 2 78 21 31 8 29 51 69 15 9 31 73
      28 49 0 28 69 7 1 22 103 0 15 23 7 1 83 38 11 10 69 22 31 22
      53 28 78 17 1 12 22 103 17 6 4 7 73 27 38 22 78 22 22 12 23
      106 7 11 4 1 0 29 32 69 8 23 6 0 7 103 10 0 69 26 29 83 51 10
      78 7 22 73 10 40 16 28 69 21 6 28 35 94 78 4 29 13 83 51 10
      78 4 31 5 83 51 13 11 69 18 7 26 42 4 2 22 83 6 21 103 17 6 0
      83 5 18 41 1 66 69 18 5 31 103 17 6 0 83 11 26 53 1 29 69 28
      15 83 51 13 11 69 18 0 1 107 69 15 11 23 73 18 43 9 78 17 27
      12 83 43 12 24 12 29 14 83 36 23 11 4 7 28 1 34 22 78 17 27 8
      7 103 6 28 4 4 5 83 40 11 78 17 27 12 83 32 23 1 16 29 13 95
      103 44 78 2 26 31 22 103 4 2 9 83 29 27 34 69 9 23 22 12 29
      103 21 2 4 29 29 0 103 3 1 23 83 15 28 40 1 64 66 83 73 50 41
      1 78 22 28 73 26 51 69 6 4 3 25 22 41 0 10 75 83 73 52 40 1
      78 9 28 6 24 34 1 78 4 7 73 22 49 0 28 28 7 1 26 41 2 78 13
      22 73 27 38 1 78 8 18 13 22 107 69 15 11 23 73 27 34 69 8 10
      6 7 23 103 12 26 69 5 12 1 62 69 9 10 28 13 93 103 69 43 19
      22 7 26 41 2 78 6 18 4 22 107 69 15 11 23 73 30 40 23 0 12 29
      14 83 33 10 2 9 28 30 22 35 69 67 72 83 29 27 34 69 29 12 11
      29 27 103 1 15 28 93 99 121 19 13 27 22 83 29 27 34 69 6 0 18
      31 22 41 22 78 4 29 13 83 51 13 11 69 22 8 1 51 13 78 4 29 13
      83 38 9 2 69 7 1 22 46 23 78 4 1 27 18 62 69 25 0 1 12 83 36
      10 3 21 31 12 7 34 1 64 69 83 58 26 41 6 11 69 28 7 83 51 13
      11 69 0 12 5 34 11 26 13 83 13 18 62 69 41 10 23 73 4 38 22
      78 3 26 7 26 52 13 11 1 83 30 26 51 13 78 17 27 12 83 48 10
      28 14 83 1 22 103 13 15 1 83 11 22 34 11 78 1 28 0 29 32 73
      78 13 22 73 1 34 22 26 0 23 73 28 41 69 26 13 22 73 0 34 19
      11 11 7 1 83 35 4 23 69 21 27 28 42 69 15 9 31 73 7 47 0 78
      18 28 27 24 103 13 11 69 27 8 23 103 16 0 1 22 27 7 38 14 11
      11 93 73 83 20 10 78 34 28 13 83 37 9 11 22 0 12 23 103 17 6
      0 83 26 22 49 0 0 17 27 73 23 38 28 78 4 29 13 83 42 4 10 0
      83 0 7 103 13 1 9 10 69 83 37 0 13 4 6 26 22 103 10 0 69 26
      29 83 47 0 78 23 22 26 7 34 1 78 3 1 6 30 103 4 2 9 83 29 27
      34 69 25 10 1 2 83 47 0 78 13 18 13 83 35 10 0 0 83 0 29 103
      6 28 0 18 29 26 40 11 64 69 83 58 6 36 13 78 12 0 73 7 47 0
      78 22 7 6 1 62 69 1 3 83 29 27 34 69 6 0 18 31 22 41 22 78 4
      29 13 83 51 13 11 69 22 8 1 51 13 78 4 7 73 7 47 0 7 23 83
      10 1 34 4 26 12 28 7 93))))

(define (char-xor a b)
  (define (xor a b)
    (cond ((eq? a b) 0)
          ((zero? a) b)
          ((zero? b) a)
          (else (+ (if (eq? (even? a) (even? b)) 0 1)
                   (* (xor (quotient a 2) (quotient b 2)) 2)))))
  (integer->char (xor (char->integer a) (char->integer b))))

(define (extract span mod text)
  (let loop ((i 0) (ts '()))
    (cond ((= (string-length text) i)
            (list->string (reverse ts)))
          ((= (modulo i span) mod)
            (let ((t (string-ref text i)))
              (loop (+ i 1) (cons t ts))))
          (else (loop (+ i 1) ts)))))

(define (freq text)
  (if (string=? "" text) '()
    (let ((txt (sort char<? (string->list text))))
      (let loop ((txt (cdr txt)) (prev (car txt)) (cnt 1) (freqs '()))
        (cond ((null? txt)
                (sort (lambda (x y) (> (cdr x) (cdr y)))
                  (cons (cons prev cnt) freqs)))
              ((char=? (car txt) prev)
                (loop (cdr txt) prev (+ cnt 1) freqs))
              (else (loop (cdr txt) (car txt) 1
                          (cons (cons prev cnt) freqs))))))))

(define (try-pass n text)
   (let loop ((i 0) (pwd '()))
     (if (= i n)
         (list->string (reverse pwd))
         (loop (+ i 1) (cons (char-xor #\space
           (caar (freq (extract n i text)))) pwd)))))

(define (crypt password text)
  (define (cycle xs) (set-cdr! (last-pair xs) xs) xs)
  (let loop ((pwd (cycle (string->list password))) (txt (string->list text)) (out '()))
    (if (null? txt) (list->string (reverse out))
      (loop (cdr pwd) (cdr txt) (cons (char-xor (car pwd) (car txt)) out)))))

(display (try-pass 1 cipher-text)) (newline)
(display (try-pass 2 cipher-text)) (newline)
(display (try-pass 3 cipher-text)) (newline)
(display (try-pass 4 cipher-text)) (newline)
(display (try-pass 5 cipher-text)) (newline)
(display (try-pass 6 cipher-text)) (newline)
(display (try-pass 7 cipher-text)) (newline)

(display (crypt "Genesis" cipher-text))


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
e
ee
ess
see 
seees
eseess
Genesis
In the beginning, when God created the heavens and the earth, the earth was a formless wasteland, and darkness covered the abyss, while a mighty wind swept over the waters.  Then God said, 'Let there be light,' and there was light.  God saw how good the light was.  God then separated the light from the darkness.  God called the light 'day,' and the darkness he called 'night.'  Thus evening came, and morning followed -- the first day.

Then God said, 'Let there be a dome in the middle of the waters, to separate one body of water from the other.'  And so it happened:  God made the dome, and it separated the water above the dome from the water below it.  God called the dome 'the sky.'  Evening came, and morning followed -- the second day.

Then God said, 'Let the water under the sky be gathered into a single basin, so that the dry land may appear.'  And so it happened: the water under the sky was gathered into its basin, and the dry land appeared.  God called the dry land 'the earth,' and the basin of the water he called 'the sea.'  God saw how good it was.  Then God said, 'Let the earth bring forth vegetation: every kind of plant that bears seed and every kind of fruit tree on earth that bears fruit with its seed in it.'  And so it happened:  the earth brought forth every kind of plant that bears seed and every kind of fruit tree on earth that bears fruit with its seed in it.  God saw how good it was.  Evening came, and morning followed -- the third day.

Then God said: 'Let there be lights in the dome of the sky, to separate day from night.  Let them mark the fixed times, the days and the years, and serve as luminaries in the dome of the sky, to shed light upon the earth.'  And so it happened:  God made the two great lights, the greater one to govern the day, and the lesser one to govern the night; and he made the stars.  God set them in the dome of the sky, to shed light upon the earth, to govern the day and the night, and to separate the light from the darkness.  God saw how good it was.  Evening came, and morning followed -- the fourth day.

Then God said, 'Let the water teem with an abundance of living creatures, and on the earth let birds fly beneath the dome of the sky.'  And so it happened:  God created the great sea monsters and all kinds of swimming creatures with which the water teems, and all kinds of winged birds.  God saw how good it was, and God blessed them, saying, 'Be fertile, multiply, and fill the water of the seas; and let the birds multiply on the earth.'  Evening came, and morning followed -- the fifth day.

Then God said, 'Let the earth bring forth all kinds of living creatures: cattle, creeping things, and wild animals of all kinds.'  And so it happened:  God made all kinds of wild animals, all kinds of cattle, and all kinds of creeping things of the earth.  God saw how good it was.  Then God said: 'Let us make man in our image, after our likeness.  Let them have dominion over the fish of the sea, the birds of the air, and the cattle, and over all the wild animals and all the creatures that crawl on the ground.'  God created man in his image; in the divine image he created him; male and female he created them.  God blessed them, saying: 'Be fertile and multiply; fill the earth and subdue it.  Have dominion over the fish of the sea, the birds of the air, and all the living things that move on the earth.'  God also said: 'See, I give you every seed-bearing plant all over the earth and every tree that has seed-bearing fruit on it to be your food; and to all the animals of the land, all the birds of the air, and all the living creatures that crawl on the ground, I give all the green plants for food.'  And so it happened.  God looked at everything he had made, and he found it very good.  Evening came, and morning followed -- the sixth day.

Thus the heavens and the earth and all their array were completed.  Since on the seventh day God was finished with the work he had been doing, he rested on the seventh day from all the work he had undertaken.  So God blessed the seventh day and made it holy, because on it he rested from all the work he had done in creation.  Such is the story of the heavens and the earth at their creation.


Create a new paste based on this one


Comments: